[OLINGO-575] Edm Cleanup part 2

This commit is contained in:
Christian Amend 2015-03-27 16:43:43 +01:00
parent 4d8a2a405e
commit 898d745bf5
32 changed files with 278 additions and 414 deletions

View File

@ -26,15 +26,17 @@ import org.apache.olingo.commons.api.edm.provider.Annotatable;
import org.apache.olingo.commons.api.edm.provider.Annotation;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public abstract class AbstractEdmAnnotatable extends AbstractEdmBase implements EdmAnnotatable {
public abstract class AbstractEdmAnnotatable implements EdmAnnotatable {
private final Annotatable annotatable;
private List<EdmAnnotation> annotations;
protected final Edm edm;
public AbstractEdmAnnotatable(final Edm edm, final Annotatable annotatable) {
super(edm);
this.edm = edm;
this.annotatable = annotatable;
}
@ -54,12 +56,12 @@ public abstract class AbstractEdmAnnotatable extends AbstractEdmBase implements
public List<EdmAnnotation> getAnnotations() {
if (annotations == null) {
annotations = new ArrayList<EdmAnnotation>();
if(annotatable != null) {
if (annotatable != null) {
for (Annotation annotation : annotatable.getAnnotations()) {
annotations.add(new EdmAnnotationImpl(edm, annotation));
}
}
}
return annotations;
return Collections.unmodifiableList(annotations);
}
}

View File

@ -1,31 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.commons.core.edm.provider;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmAnnotatable;
public abstract class AbstractEdmBase implements EdmAnnotatable {
protected final Edm edm;
public AbstractEdmBase(final Edm edm) {
this.edm = edm;
}
}

View File

@ -19,6 +19,7 @@
package org.apache.olingo.commons.core.edm.provider;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
@ -29,7 +30,6 @@ import org.apache.olingo.commons.api.edm.EdmEntityType;
import org.apache.olingo.commons.api.edm.EdmException;
import org.apache.olingo.commons.api.edm.EdmNavigationPropertyBinding;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.Target;
import org.apache.olingo.commons.api.edm.provider.BindingTarget;
import org.apache.olingo.commons.api.edm.provider.NavigationPropertyBinding;
@ -57,7 +57,7 @@ public abstract class AbstractEdmBindingTarget extends AbstractEdmNamed implemen
}
}
}
return navigationPropertyBindings;
return Collections.unmodifiableList(navigationPropertyBindings);
}
@Override
@ -96,8 +96,11 @@ public abstract class AbstractEdmBindingTarget extends AbstractEdmNamed implemen
&& !found;) {
final EdmNavigationPropertyBinding binding = itor.next();
if(binding.getPath() == null || binding.getTarget() == null){
throw new EdmException("Path or Target in navigation property binding must not be null!");
}
if (path.startsWith(binding.getPath())) {
final Target edmTarget = new Target.Builder(binding.getTarget(), container).build();
final Target edmTarget = new Target(binding.getTarget(), container);
final EdmEntityContainer entityContainer = edm.getEntityContainer(edmTarget.getEntityContainer());
if (entityContainer == null) {

View File

@ -19,6 +19,7 @@
package org.apache.olingo.commons.core.edm.provider;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@ -37,85 +38,58 @@ import org.apache.olingo.commons.api.edm.provider.Parameter;
public abstract class AbstractEdmOperation extends EdmTypeImpl implements EdmOperation {
protected final Operation operation;
private final Map<String, EdmParameter> parameters = new LinkedHashMap<String, EdmParameter>();
private String entitySetPath;
private boolean isBound;
private EdmReturnType returnType;
private final Operation operation;
private Map<String, EdmParameter> parameters;
private List<String> parameterNames;
protected static <T extends AbstractEdmOperation> T getInstance(final T instance) {
final List<Parameter> providerParameters = instance.operation.getParameters();
if (providerParameters != null) {
final List<EdmParameter> _parameters = new ArrayList<EdmParameter>(providerParameters.size());
for (Parameter parameter : providerParameters) {
_parameters.add(new EdmParameterImpl(instance.edm, parameter));
}
instance.setParameters(_parameters);
}
final String entitySetPath = instance.operation.getEntitySetPath();
if (entitySetPath != null) {
instance.setEntitySetPath(entitySetPath);
}
instance.setIsBound(instance.operation.isBound());
if (instance.operation.getReturnType() != null) {
instance.setReturnType(new EdmReturnTypeImpl(instance.edm, instance.operation.getReturnType()));
}
return instance;
}
private EdmReturnType returnType;
protected AbstractEdmOperation(final Edm edm, final FullQualifiedName name, final Operation operation,
final EdmTypeKind kind) {
final EdmTypeKind kind) {
super(edm, name, kind, operation);
this.operation = operation;
}
protected void setParameters(final List<EdmParameter> _parameters) {
for (EdmParameter parameter : _parameters) {
parameters.put(parameter.getName(), parameter);
}
}
protected void setEntitySetPath(final String entitySetPath) {
this.entitySetPath = entitySetPath;
}
protected void setIsBound(final boolean isBound) {
this.isBound = isBound;
}
protected void setReturnType(final EdmReturnType returnType) {
this.returnType = returnType;
}
@Override
public EdmParameter getParameter(final String name) {
if (parameters == null) {
createParameters();
}
return parameters.get(name);
}
@Override
public List<String> getParameterNames() {
if (parameterNames == null) {
parameterNames = new ArrayList<String>(parameters.size());
for (String parameterName : parameters.keySet()) {
parameterNames.add(parameterName);
}
createParameters();
}
return Collections.unmodifiableList(parameterNames);
}
private void createParameters() {
parameters = new LinkedHashMap<String, EdmParameter>();
final List<Parameter> providerParameters = operation.getParameters();
if (providerParameters != null) {
parameterNames = new ArrayList<String>(providerParameters.size());
for (Parameter parameter : providerParameters) {
parameters.put(parameter.getName(), new EdmParameterImpl(edm, parameter));
parameterNames.add(parameter.getName());
}
} else {
parameterNames = Collections.emptyList();
}
return parameterNames;
}
@Override
public EdmEntitySet getReturnedEntitySet(final EdmEntitySet bindingParameterEntitySet) {
EdmEntitySet returnedEntitySet = null;
if (bindingParameterEntitySet != null && entitySetPath != null) {
final EdmBindingTarget relatedBindingTarget = bindingParameterEntitySet.getRelatedBindingTarget(entitySetPath);
if (bindingParameterEntitySet != null && operation.getEntitySetPath() != null) {
final EdmBindingTarget relatedBindingTarget =
bindingParameterEntitySet.getRelatedBindingTarget(operation.getEntitySetPath());
if (relatedBindingTarget == null) {
throw new EdmException("Cannot find entity set with path: " + entitySetPath);
throw new EdmException("Cannot find entity set with path: " + operation.getEntitySetPath());
}
if (relatedBindingTarget instanceof EdmEntitySet) {
returnedEntitySet = (EdmEntitySet) relatedBindingTarget;
@ -129,12 +103,15 @@ public abstract class AbstractEdmOperation extends EdmTypeImpl implements EdmOpe
@Override
public EdmReturnType getReturnType() {
if (returnType == null && operation.getReturnType() != null) {
returnType = new EdmReturnTypeImpl(edm, operation.getReturnType());
}
return returnType;
}
@Override
public boolean isBound() {
return isBound;
return operation.isBound();
}
@Override
@ -156,7 +133,7 @@ public abstract class AbstractEdmOperation extends EdmTypeImpl implements EdmOpe
}
@Override
public String getEntitySetPath(){
public String getEntitySetPath() {
return operation.getEntitySetPath();
}
}

View File

@ -24,7 +24,6 @@ import org.apache.olingo.commons.api.edm.EdmEntitySet;
import org.apache.olingo.commons.api.edm.EdmException;
import org.apache.olingo.commons.api.edm.EdmOperationImport;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.Target;
import org.apache.olingo.commons.api.edm.provider.OperationImport;
public abstract class AbstractEdmOperationImport extends AbstractEdmNamed implements EdmOperationImport {
@ -34,10 +33,14 @@ public abstract class AbstractEdmOperationImport extends AbstractEdmNamed implem
private EdmEntitySet returnedEntitySet;
public AbstractEdmOperationImport(final Edm edm, final EdmEntityContainer container,
final OperationImport operationImport) {
final OperationImport operationImport) {
super(edm, operationImport.getName(), operationImport);
this.container = container;
this.entitySet = new Target.Builder(operationImport.getEntitySet(), container).build();
if (operationImport.getEntitySet() != null) {
this.entitySet = new Target(operationImport.getEntitySet(), container);
} else {
this.entitySet = null;
}
}
@Override

View File

@ -32,6 +32,7 @@ import org.apache.olingo.commons.api.edm.provider.Property;
import org.apache.olingo.commons.api.edm.provider.StructuralType;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@ -40,12 +41,13 @@ public abstract class AbstractEdmStructuredType extends EdmTypeImpl implements E
protected EdmStructuredType baseType;
protected FullQualifiedName baseTypeName;
private final StructuralType providerStructuredType;
private List<String> propertyNames;
private List<String> navigationPropertyNames;
private Map<String, EdmProperty> properties;
private List<String> navigationPropertyNames;
private Map<String, EdmNavigationProperty> navigationProperties;
private final StructuralType structuredType;
public AbstractEdmStructuredType(
final Edm edm,
@ -55,7 +57,7 @@ public abstract class AbstractEdmStructuredType extends EdmTypeImpl implements E
super(edm, typeName, kind, structuredType);
this.baseTypeName = structuredType.getBaseTypeFQN();
this.structuredType = structuredType;
this.providerStructuredType = structuredType;
}
protected abstract EdmStructuredType buildBaseType(FullQualifiedName baseTypeName);
@ -72,7 +74,7 @@ public abstract class AbstractEdmStructuredType extends EdmTypeImpl implements E
}
propertyNames.addAll(getProperties().keySet());
}
return propertyNames;
return Collections.unmodifiableList(propertyNames);
}
@Override
@ -85,7 +87,7 @@ public abstract class AbstractEdmStructuredType extends EdmTypeImpl implements E
}
navigationPropertyNames.addAll(getNavigationProperties().keySet());
}
return navigationPropertyNames;
return Collections.unmodifiableList(navigationPropertyNames);
}
@Override
@ -154,31 +156,31 @@ public abstract class AbstractEdmStructuredType extends EdmTypeImpl implements E
public Map<String, EdmProperty> getProperties() {
if (properties == null) {
properties = new LinkedHashMap<String, EdmProperty>();
for (Property property : structuredType.getProperties()) {
for (Property property : providerStructuredType.getProperties()) {
properties.put(property.getName(), new EdmPropertyImpl(edm, typeName, property));
}
}
return properties;
return Collections.unmodifiableMap(properties);
}
public Map<String, EdmNavigationProperty> getNavigationProperties() {
if (navigationProperties == null) {
navigationProperties = new LinkedHashMap<String, EdmNavigationProperty>();
if (structuredType.getNavigationProperties() != null) {
for (NavigationProperty navigationProperty : structuredType.getNavigationProperties()) {
if (providerStructuredType.getNavigationProperties() != null) {
for (NavigationProperty navigationProperty : providerStructuredType.getNavigationProperties()) {
navigationProperties.put(navigationProperty.getName(),
new EdmNavigationPropertyImpl(edm, typeName, navigationProperty));
}
}
}
return navigationProperties;
return Collections.unmodifiableMap(navigationProperties);
}
public boolean isOpenType() {
return structuredType.isOpenType();
return providerStructuredType.isOpenType();
}
public boolean isAbstract() {
return structuredType.isAbstract();
return providerStructuredType.isAbstract();
}
}

View File

@ -26,11 +26,7 @@ import org.apache.olingo.commons.api.edm.provider.Action;
public class EdmActionImpl extends AbstractEdmOperation implements EdmAction {
public static EdmActionImpl getInstance(final Edm edm, final FullQualifiedName name, final Action action) {
return AbstractEdmOperation.getInstance(new EdmActionImpl(edm, name, action));
}
private EdmActionImpl(final Edm edm, final FullQualifiedName name, final Action action) {
public EdmActionImpl(final Edm edm, final FullQualifiedName name, final Action action) {
super(edm, name, action, EdmTypeKind.ACTION);
}
}

View File

@ -19,6 +19,7 @@
package org.apache.olingo.commons.core.edm.provider;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
@ -137,7 +138,7 @@ public class EdmAnnotationsImpl implements EdmAnnotations {
annotations.add(new EdmAnnotationImpl(edm, annotation));
}
}
return annotations;
return Collections.unmodifiableList(annotations);
}
}

View File

@ -28,12 +28,7 @@ import org.apache.olingo.commons.api.edm.provider.ComplexType;
public class EdmComplexTypeImpl extends AbstractEdmStructuredType implements EdmComplexType {
public static EdmComplexTypeImpl getInstance(
final Edm edm, final FullQualifiedName name, final ComplexType complexType) {
return new EdmComplexTypeImpl(edm, name, complexType);
}
private EdmComplexTypeImpl(final Edm edm, final FullQualifiedName name, final ComplexType complexType) {
public EdmComplexTypeImpl(final Edm edm, final FullQualifiedName name, final ComplexType complexType) {
super(edm, name, EdmTypeKind.COMPLEX, complexType);
}

View File

@ -19,7 +19,8 @@
package org.apache.olingo.commons.core.edm.provider;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@ -45,22 +46,22 @@ public class EdmEntityContainerImpl extends AbstractEdmNamed implements EdmEntit
private final EdmProvider provider;
private EntityContainer container;
protected final FullQualifiedName entityContainerName;
private final FullQualifiedName entityContainerName;
private final FullQualifiedName parentContainerName;
protected final Map<String, EdmSingleton> singletons = new HashMap<String, EdmSingleton>();
private boolean allSingletonsLoaded = false;
private final Map<String, EdmSingleton> singletonCache = new LinkedHashMap<String, EdmSingleton>();
private List<EdmSingleton> singletons;
protected final Map<String, EdmEntitySet> entitySets = new HashMap<String, EdmEntitySet>();
private boolean allEntitySetsLoaded = false;
private final Map<String, EdmEntitySet> entitySetCache = new LinkedHashMap<String, EdmEntitySet>();
private List<EdmEntitySet> entitySets;
protected final Map<String, EdmActionImport> actionImports = new HashMap<String, EdmActionImport>();
private boolean allActionImportsLoaded = false;
private final Map<String, EdmActionImport> actionImportCache = new LinkedHashMap<String, EdmActionImport>();
private List<EdmActionImport> actionImports;
protected final Map<String, EdmFunctionImport> functionImports = new HashMap<String, EdmFunctionImport>();
private boolean allFunctionImportsLoaded = false;
private final Map<String, EdmFunctionImport> functionImportCache = new LinkedHashMap<String, EdmFunctionImport>();
private List<EdmFunctionImport> functionImports;
public EdmEntityContainerImpl(final Edm edm, final EdmProvider provider,
public EdmEntityContainerImpl(final Edm edm, final EdmProvider provider,
final EntityContainerInfo entityContainerInfo) {
super(edm, entityContainerInfo.getContainerName().getName(), null);
this.provider = provider;
@ -89,11 +90,11 @@ public class EdmEntityContainerImpl extends AbstractEdmNamed implements EdmEntit
@Override
public EdmSingleton getSingleton(final String singletonName) {
EdmSingleton singleton = singletons.get(singletonName);
EdmSingleton singleton = singletonCache.get(singletonName);
if (singleton == null) {
singleton = createSingleton(singletonName);
if (singleton != null) {
singletons.put(singletonName, singleton);
singletonCache.put(singletonName, singleton);
}
}
return singleton;
@ -101,11 +102,11 @@ public class EdmEntityContainerImpl extends AbstractEdmNamed implements EdmEntit
@Override
public EdmEntitySet getEntitySet(final String entitySetName) {
EdmEntitySet entitySet = entitySets.get(entitySetName);
EdmEntitySet entitySet = entitySetCache.get(entitySetName);
if (entitySet == null) {
entitySet = createEntitySet(entitySetName);
if (entitySet != null) {
entitySets.put(entitySetName, entitySet);
entitySetCache.put(entitySetName, entitySet);
}
}
return entitySet;
@ -113,11 +114,11 @@ public class EdmEntityContainerImpl extends AbstractEdmNamed implements EdmEntit
@Override
public EdmActionImport getActionImport(final String actionImportName) {
EdmActionImport actionImport = actionImports.get(actionImportName);
EdmActionImport actionImport = actionImportCache.get(actionImportName);
if (actionImport == null) {
actionImport = createActionImport(actionImportName);
if (actionImport != null) {
actionImports.put(actionImportName, actionImport);
actionImportCache.put(actionImportName, actionImport);
}
}
return actionImport;
@ -125,11 +126,11 @@ public class EdmEntityContainerImpl extends AbstractEdmNamed implements EdmEntit
@Override
public EdmFunctionImport getFunctionImport(final String functionImportName) {
EdmFunctionImport functionImport = functionImports.get(functionImportName);
EdmFunctionImport functionImport = functionImportCache.get(functionImportName);
if (functionImport == null) {
functionImport = createFunctionImport(functionImportName);
if (functionImport != null) {
functionImports.put(functionImportName, functionImport);
functionImportCache.put(functionImportName, functionImport);
}
}
return functionImport;
@ -137,38 +138,34 @@ public class EdmEntityContainerImpl extends AbstractEdmNamed implements EdmEntit
@Override
public List<EdmEntitySet> getEntitySets() {
if (!allEntitySetsLoaded) {
if (entitySets == null) {
loadAllEntitySets();
allEntitySetsLoaded = true;
}
return new ArrayList<EdmEntitySet>(entitySets.values());
return Collections.unmodifiableList(entitySets);
}
@Override
public List<EdmFunctionImport> getFunctionImports() {
if (!allFunctionImportsLoaded) {
if (functionImports == null) {
loadAllFunctionImports();
allFunctionImportsLoaded = true;
}
return new ArrayList<EdmFunctionImport>(functionImports.values());
return Collections.unmodifiableList(functionImports);
}
@Override
public List<EdmSingleton> getSingletons() {
if (!allSingletonsLoaded) {
if (singletons == null) {
loadAllSingletons();
allSingletonsLoaded = true;
}
return new ArrayList<EdmSingleton>(singletons.values());
return Collections.unmodifiableList(singletons);
}
@Override
public List<EdmActionImport> getActionImports() {
if (!allActionImportsLoaded) {
if (actionImports == null) {
loadAllActionImports();
allActionImportsLoaded = true;
}
return new ArrayList<EdmActionImport>(actionImports.values());
return Collections.unmodifiableList(actionImports);
}
@Override
@ -176,7 +173,6 @@ public class EdmEntityContainerImpl extends AbstractEdmNamed implements EdmEntit
return parentContainerName;
}
protected EdmSingleton createSingleton(final String singletonName) {
EdmSingleton singleton = null;
@ -240,12 +236,12 @@ public class EdmEntityContainerImpl extends AbstractEdmNamed implements EdmEntit
protected void loadAllEntitySets() {
loadContainer();
List<EntitySet> providerEntitySets = container.getEntitySets();
entitySets = new ArrayList<EdmEntitySet>();
if (providerEntitySets != null) {
for (EntitySet entitySet : providerEntitySets) {
if (!entitySets.containsKey(entitySet.getName())) {
EdmEntitySetImpl impl = new EdmEntitySetImpl(edm, this, entitySet);
entitySets.put(impl.getName(), impl);
}
EdmEntitySetImpl impl = new EdmEntitySetImpl(edm, this, entitySet);
entitySetCache.put(impl.getName(), impl);
entitySets.add(impl);
}
}
}
@ -253,13 +249,12 @@ public class EdmEntityContainerImpl extends AbstractEdmNamed implements EdmEntit
protected void loadAllFunctionImports() {
loadContainer();
List<FunctionImport> providerFunctionImports = container.getFunctionImports();
functionImports = new ArrayList<EdmFunctionImport>();
if (providerFunctionImports != null) {
for (FunctionImport functionImport : providerFunctionImports) {
String functionName = functionImport.getName();
if (!functionImports.containsKey(functionName)) {
functionImports.put(functionName,
new EdmFunctionImportImpl(edm, this, functionImport));
}
EdmFunctionImportImpl impl = new EdmFunctionImportImpl(edm, this, functionImport);
functionImportCache.put(impl.getName(), impl);
functionImports.add(impl);
}
}
@ -268,12 +263,12 @@ public class EdmEntityContainerImpl extends AbstractEdmNamed implements EdmEntit
protected void loadAllSingletons() {
loadContainer();
List<Singleton> providerSingletons = container.getSingletons();
singletons = new ArrayList<EdmSingleton>();
if (providerSingletons != null) {
for (Singleton singleton : providerSingletons) {
if (!singletons.containsKey(singleton.getName())) {
EdmSingletonImpl impl = new EdmSingletonImpl(edm, this, singleton);
singletons.put(singleton.getName(), impl);
}
EdmSingletonImpl impl = new EdmSingletonImpl(edm, this, singleton);
singletonCache.put(singleton.getName(), impl);
singletons.add(impl);
}
}
@ -282,12 +277,12 @@ public class EdmEntityContainerImpl extends AbstractEdmNamed implements EdmEntit
protected void loadAllActionImports() {
loadContainer();
List<ActionImport> providerActionImports = container.getActionImports();
actionImports = new ArrayList<EdmActionImport>();
if (providerActionImports != null) {
for (ActionImport actionImport : providerActionImports) {
if (!actionImports.containsKey(actionImport.getName())) {
EdmActionImportImpl impl = new EdmActionImportImpl(edm, this, actionImport);
actionImports.put(actionImport.getName(), impl);
}
EdmActionImportImpl impl = new EdmActionImportImpl(edm, this, actionImport);
actionImportCache.put(actionImport.getName(), impl);
actionImports.add(impl);
}
}
@ -298,7 +293,6 @@ public class EdmEntityContainerImpl extends AbstractEdmNamed implements EdmEntit
try {
container = provider.getEntityContainer();
if (container == null) {
// TODO: Should we throw an exception here?
container = new EntityContainer().setName(getName());
}
} catch (ODataException e) {
@ -316,7 +310,7 @@ public class EdmEntityContainerImpl extends AbstractEdmNamed implements EdmEntit
public FullQualifiedName getAnnotationsTargetFQN() {
return getFullQualifiedName();
}
@Override
public TargetType getAnnotationsTargetType() {
return TargetType.EntityContainer;

View File

@ -19,6 +19,7 @@
package org.apache.olingo.commons.core.edm.provider;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@ -43,13 +44,7 @@ public class EdmEntityTypeImpl extends AbstractEdmStructuredType implements EdmE
private final Map<String, EdmKeyPropertyRef> keyPropertyRefs = new LinkedHashMap<String, EdmKeyPropertyRef>();
private List<EdmKeyPropertyRef> keyPropertyRefsList;
public static EdmEntityTypeImpl getInstance(final Edm edm, final FullQualifiedName name,
final EntityType entityType) {
return new EdmEntityTypeImpl(edm, name, entityType);
}
private EdmEntityTypeImpl(final Edm edm, final FullQualifiedName name, final EntityType entityType) {
public EdmEntityTypeImpl(final Edm edm, final FullQualifiedName name, final EntityType entityType) {
super(edm, name, EdmTypeKind.ENTITY, entityType);
this.entityType = entityType;
hasStream = entityType.hasStream();
@ -113,7 +108,7 @@ public class EdmEntityTypeImpl extends AbstractEdmStructuredType implements EdmE
if (keyPredicateNames.isEmpty() && baseType != null) {
return entityBaseType.getKeyPredicateNames();
}
return keyPredicateNames;
return Collections.unmodifiableList(keyPredicateNames);
}
@Override
@ -125,7 +120,7 @@ public class EdmEntityTypeImpl extends AbstractEdmStructuredType implements EdmE
if (keyPropertyRefsList.isEmpty() && entityBaseType != null) {
return entityBaseType.getKeyPropertyRefs();
}
return keyPropertyRefsList;
return Collections.unmodifiableList(keyPropertyRefsList);
}
@Override

View File

@ -20,6 +20,7 @@ package org.apache.olingo.commons.core.edm.provider;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
@ -94,7 +95,7 @@ public class EdmEnumTypeImpl extends EdmTypeImpl implements EdmEnumType {
if (memberNames == null) {
createEdmMembers();
}
return memberNames;
return Collections.unmodifiableList(memberNames);
}
private void createEdmMembers() {

View File

@ -30,11 +30,7 @@ public class EdmFunctionImpl extends AbstractEdmOperation implements EdmFunction
private final Function function;
public static EdmFunctionImpl getInstance(final Edm edm, final FullQualifiedName name, final Function function) {
return AbstractEdmOperation.getInstance(new EdmFunctionImpl(edm, name, function));
}
private EdmFunctionImpl(final Edm edm, final FullQualifiedName name, final Function function) {
public EdmFunctionImpl(final Edm edm, final FullQualifiedName name, final Function function) {
super(edm, name, function, EdmTypeKind.FUNCTION);
this.function = function;
}

View File

@ -19,6 +19,7 @@
package org.apache.olingo.commons.core.edm.provider;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.apache.olingo.commons.api.edm.Edm;
@ -119,7 +120,7 @@ public class EdmNavigationPropertyImpl extends AbstractEdmNamed implements EdmEl
}
}
}
return referentialConstraints;
return Collections.unmodifiableList(referentialConstraints);
}
@Override

View File

@ -110,7 +110,7 @@ public class EdmProviderImpl extends AbstractEdm {
try {
EntityType entityType = provider.getEntityType(entityTypeName);
if (entityType != null) {
return EdmEntityTypeImpl.getInstance(this, entityTypeName, entityType);
return new EdmEntityTypeImpl(this, entityTypeName, entityType);
}
return null;
} catch (ODataException e) {
@ -123,7 +123,7 @@ public class EdmProviderImpl extends AbstractEdm {
try {
final ComplexType complexType = provider.getComplexType(complexTypeName);
if (complexType != null) {
return EdmComplexTypeImpl.getInstance(this, complexTypeName, complexType);
return new EdmComplexTypeImpl(this, complexTypeName, complexType);
}
return null;
} catch (ODataException e) {
@ -153,7 +153,7 @@ public class EdmProviderImpl extends AbstractEdm {
if (bindingParameterTypeName.equals(parameter.getTypeFQN())
&& isBindingParameterCollection.booleanValue() == parameter.isCollection()) {
return EdmActionImpl.getInstance(this, actionName, action);
return new EdmActionImpl(this, actionName, action);
}
}
@ -197,7 +197,7 @@ public class EdmProviderImpl extends AbstractEdm {
providerParameterNames.add(providerParameters.get(i).getName());
}
if (parameterNamesCopy.containsAll(providerParameterNames)) {
return EdmFunctionImpl.getInstance(this, functionName, function);
return new EdmFunctionImpl(this, functionName, function);
}
}
}
@ -240,7 +240,7 @@ public class EdmProviderImpl extends AbstractEdm {
// Search for first unbound action
for (Action action : actions) {
if (!action.isBound()) {
return EdmActionImpl.getInstance(this, actionName, action);
return new EdmActionImpl(this, actionName, action);
}
}
return null;
@ -264,7 +264,7 @@ public class EdmProviderImpl extends AbstractEdm {
if (functions != null) {
for (Function function : functions) {
if (!function.isBound()) {
result.add(EdmFunctionImpl.getInstance(this, functionName, function));
result.add(new EdmFunctionImpl(this, functionName, function));
}
}
}
@ -303,7 +303,7 @@ public class EdmProviderImpl extends AbstractEdm {
}
if (parameterNamesCopy.containsAll(functionParameterNames)) {
return EdmFunctionImpl.getInstance(this, functionName, function);
return new EdmFunctionImpl(this, functionName, function);
}
}
}

View File

@ -31,7 +31,6 @@ public class EdmReturnTypeImpl implements EdmReturnType {
private final EdmTypeInfo typeInfo;
private EdmType typeImpl;
public EdmReturnTypeImpl(final Edm edm, final ReturnType returnType) {
this.returnType = returnType;
this.typeInfo = new EdmTypeInfo.Builder().setEdm(edm).setTypeExpression(returnType.getType()).build();

View File

@ -52,7 +52,7 @@ public class EdmSchemaImpl implements EdmSchema {
private final Schema schema;
private final Edm edm;
private final EdmProvider provider;
protected final String namespace;
private final String alias;
private List<EdmEnumType> enumTypes;
@ -79,7 +79,7 @@ public class EdmSchemaImpl implements EdmSchema {
if (enumTypes == null) {
enumTypes = createEnumTypes();
}
return enumTypes;
return Collections.unmodifiableList(enumTypes);
}
@Override
@ -87,7 +87,7 @@ public class EdmSchemaImpl implements EdmSchema {
if (entityTypes == null) {
entityTypes = createEntityTypes();
}
return entityTypes;
return Collections.unmodifiableList(entityTypes);
}
@Override
@ -95,7 +95,7 @@ public class EdmSchemaImpl implements EdmSchema {
if (complexTypes == null) {
complexTypes = createComplexTypes();
}
return complexTypes;
return Collections.unmodifiableList(complexTypes);
}
@Override
@ -103,7 +103,7 @@ public class EdmSchemaImpl implements EdmSchema {
if (actions == null) {
actions = createActions();
}
return actions;
return Collections.unmodifiableList(actions);
}
@Override
@ -111,7 +111,7 @@ public class EdmSchemaImpl implements EdmSchema {
if (functions == null) {
functions = createFunctions();
}
return functions;
return Collections.unmodifiableList(functions);
}
@Override
@ -119,7 +119,7 @@ public class EdmSchemaImpl implements EdmSchema {
if (typeDefinitions == null) {
typeDefinitions = createTypeDefinitions();
}
return typeDefinitions;
return Collections.unmodifiableList(typeDefinitions);
}
@Override
@ -127,7 +127,7 @@ public class EdmSchemaImpl implements EdmSchema {
if (terms == null) {
terms = createTerms();
}
return terms;
return Collections.unmodifiableList(terms);
}
@Override
@ -135,7 +135,7 @@ public class EdmSchemaImpl implements EdmSchema {
if (annotationGroups == null) {
annotationGroups = createAnnotationGroups();
}
return annotationGroups;
return Collections.unmodifiableList(annotationGroups);
}
@Override
@ -143,7 +143,7 @@ public class EdmSchemaImpl implements EdmSchema {
if (annotations == null) {
annotations = createAnnotations();
}
return annotations;
return Collections.unmodifiableList(annotations);
}
@Override
@ -159,7 +159,7 @@ public class EdmSchemaImpl implements EdmSchema {
if (getEntityContainer() == null) {
return Collections.<EdmEntityContainer> emptyList();
} else {
return Collections.singletonList(getEntityContainer());
return Collections.unmodifiableList(Collections.singletonList(getEntityContainer()));
}
}
@ -183,7 +183,7 @@ public class EdmSchemaImpl implements EdmSchema {
public String getAlias() {
return alias;
}
protected EdmEntityContainer createEntityContainer() {
if (schema.getEntityContainer() != null) {
FullQualifiedName containerFQN = new FullQualifiedName(namespace, schema.getEntityContainer().getName());
@ -219,7 +219,7 @@ public class EdmSchemaImpl implements EdmSchema {
final List<EntityType> providerEntityTypes = schema.getEntityTypes();
if (providerEntityTypes != null) {
for (EntityType entityType : providerEntityTypes) {
entityTypes.add(EdmEntityTypeImpl.getInstance(edm, new FullQualifiedName(namespace, entityType.getName()),
entityTypes.add(new EdmEntityTypeImpl(edm, new FullQualifiedName(namespace, entityType.getName()),
entityType));
}
}
@ -231,7 +231,7 @@ public class EdmSchemaImpl implements EdmSchema {
final List<ComplexType> providerComplexTypes = schema.getComplexTypes();
if (providerComplexTypes != null) {
for (ComplexType complexType : providerComplexTypes) {
complexTypes.add(EdmComplexTypeImpl.getInstance(edm, new FullQualifiedName(namespace, complexType.getName()),
complexTypes.add(new EdmComplexTypeImpl(edm, new FullQualifiedName(namespace, complexType.getName()),
complexType));
}
}
@ -243,7 +243,7 @@ public class EdmSchemaImpl implements EdmSchema {
final List<Action> providerActions = schema.getActions();
if (providerActions != null) {
for (Action action : providerActions) {
actions.add(EdmActionImpl.getInstance(edm, new FullQualifiedName(namespace, action.getName()), action));
actions.add(new EdmActionImpl(edm, new FullQualifiedName(namespace, action.getName()), action));
}
}
return actions;
@ -254,7 +254,7 @@ public class EdmSchemaImpl implements EdmSchema {
final List<Function> providerFunctions = schema.getFunctions();
if (providerFunctions != null) {
for (Function function : providerFunctions) {
functions.add(EdmFunctionImpl.getInstance(edm, new FullQualifiedName(namespace, function.getName()), function));
functions.add(new EdmFunctionImpl(edm, new FullQualifiedName(namespace, function.getName()), function));
}
}
return functions;

View File

@ -16,7 +16,10 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.commons.api.edm;
package org.apache.olingo.commons.core.edm.provider;
import org.apache.olingo.commons.api.edm.EdmEntityContainer;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
/**
* An Edm target element. It contains a target as a String name as well as the {@link FullQualifiedName} of the entity
@ -25,32 +28,16 @@ package org.apache.olingo.commons.api.edm;
public class Target {
private String targetName;
private FullQualifiedName entityContainer;
public static class Builder {
private final Target instance;
public Builder(final String target, final EdmEntityContainer defaultContainer) {
if (target != null) {
final String[] bindingTargetParts = target.split("/");
instance = new Target();
if (bindingTargetParts.length == 1) {
instance.setEntityContainer(defaultContainer.getFullQualifiedName()).
setTargetName(bindingTargetParts[0]);
} else {
instance.setEntityContainer(new FullQualifiedName(bindingTargetParts[0])).
setTargetName(bindingTargetParts[1]);
}
} else {
instance = null;
}
}
public Target build() {
return instance;
public Target(String target, EdmEntityContainer defaultContainer) {
final String[] bindingTargetParts = target.split("/");
if (bindingTargetParts.length == 1) {
entityContainer = defaultContainer.getFullQualifiedName();
targetName = bindingTargetParts[0];
} else {
entityContainer = new FullQualifiedName(bindingTargetParts[0]);
targetName = bindingTargetParts[1];
}
}
@ -61,11 +48,6 @@ public class Target {
return targetName;
}
public Target setTargetName(final String targetPathName) {
targetName = targetPathName;
return this;
}
/**
* @return {@link FullQualifiedName} of the entity container this target is contained in.
*/
@ -73,14 +55,9 @@ public class Target {
return entityContainer;
}
public Target setEntityContainer(final FullQualifiedName entityContainer) {
this.entityContainer = entityContainer;
return this;
}
@Override
public String toString() {
if(entityContainer == null){
if (entityContainer == null) {
return targetName;
}
return entityContainer.getFullQualifiedNameAsString() + "/" + targetName;

View File

@ -18,6 +18,7 @@
*/
package org.apache.olingo.server.core.serializer.xml;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -471,7 +472,7 @@ public class MetadataDocumentXmlSerializer {
private void appendNavigationProperties(final XMLStreamWriter writer, final EdmStructuredType type)
throws XMLStreamException {
List<String> navigationPropertyNames = type.getNavigationPropertyNames();
List<String> navigationPropertyNames = new ArrayList<String>(type.getNavigationPropertyNames());
if (type.getBaseType() != null) {
navigationPropertyNames.removeAll(type.getBaseType().getNavigationPropertyNames());
}
@ -504,7 +505,7 @@ public class MetadataDocumentXmlSerializer {
}
private void appendProperties(final XMLStreamWriter writer, final EdmStructuredType type) throws XMLStreamException {
List<String> propertyNames = type.getPropertyNames();
List<String> propertyNames = new ArrayList<String>(type.getPropertyNames());
if (type.getBaseType() != null) {
propertyNames.removeAll(type.getBaseType().getPropertyNames());
}

View File

@ -58,19 +58,19 @@ public class EdmActionImplTest {
parameters.add(new Parameter().setName("Id").setType(new FullQualifiedName("namespace", "name")));
FullQualifiedName action1Name = new FullQualifiedName("namespace", "action1");
Action action1 = new Action().setName("action1").setBound(true).setParameters(parameters);
actionImpl1 = EdmActionImpl.getInstance(provider, action1Name, action1);
actionImpl1 = new EdmActionImpl(provider, action1Name, action1);
FullQualifiedName action2Name = new FullQualifiedName("namespace", "action2");
FullQualifiedName returnTypeName = new FullQualifiedName("Edm", "String");
ReturnType returnType = new ReturnType().setType(returnTypeName);
Action action2 = new Action().setName("action2").setParameters(parameters).setReturnType(returnType);
actionImpl2 = EdmActionImpl.getInstance(provider, action2Name, action2);
actionImpl2 = new EdmActionImpl(provider, action2Name, action2);
FullQualifiedName action3Name = new FullQualifiedName("namespace", "action3");
Action action3 =
new Action().setName("action3").setParameters(parameters).setReturnType(returnType).setEntitySetPath(
"path/Id");
actionImpl3 = EdmActionImpl.getInstance(provider, action3Name, action3);
actionImpl3 = new EdmActionImpl(provider, action3Name, action3);
}
@Test

View File

@ -18,25 +18,24 @@
*/
package org.apache.olingo.server.core.edm.provider;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import org.apache.olingo.commons.api.edm.EdmAction;
import org.apache.olingo.commons.api.edm.EdmActionImport;
import org.apache.olingo.commons.api.edm.EdmEntityContainer;
import org.apache.olingo.commons.api.edm.EdmEntitySet;
import org.apache.olingo.commons.api.edm.EdmException;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.Target;
import org.apache.olingo.commons.api.edm.provider.ActionImport;
import org.apache.olingo.commons.core.edm.provider.EdmActionImportImpl;
import org.apache.olingo.commons.core.edm.provider.EdmProviderImpl;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public class EdmActionImportImplTest {
EdmEntityContainer container;
@ -51,9 +50,9 @@ public class EdmActionImportImplTest {
public void setup() {
FullQualifiedName actionFqn = new FullQualifiedName("namespace", "actionName");
FullQualifiedName entityContainerFqn = new FullQualifiedName("namespace", "containerName");
Target target = new Target().setEntityContainer(entityContainerFqn).setTargetName("entitySetName");
String target = entityContainerFqn.getFullQualifiedNameAsString() + "/entitySetName";
ActionImport providerActionImport =
new ActionImport().setName("actionImportName").setAction(actionFqn).setEntitySet(target.toString());
new ActionImport().setName("actionImportName").setAction(actionFqn).setEntitySet(target);
EdmProviderImpl edm = mock(EdmProviderImpl.class);
container = mock(EdmEntityContainer.class);
@ -85,8 +84,8 @@ public class EdmActionImportImplTest {
@Test(expected = EdmException.class)
public void getReturnedEntitySetNonExistingContainer() {
Target target = new Target().setEntityContainer(new FullQualifiedName("alias.nonexisting")).setTargetName("Es");
ActionImport providerActionImport = new ActionImport().setName("actionImportName").setEntitySet(target.toString());
String target = "alias.nonexisting/Es";
ActionImport providerActionImport = new ActionImport().setName("actionImportName").setEntitySet(target);
EdmActionImport actionImport =
new EdmActionImportImpl(mock(EdmProviderImpl.class), container, providerActionImport);
actionImport.getReturnedEntitySet();
@ -94,8 +93,8 @@ public class EdmActionImportImplTest {
@Test(expected = EdmException.class)
public void getReturnedEntitySetNonExistingEntitySet() {
Target target = new Target().setTargetName("nonExisting");
ActionImport providerActionImport = new ActionImport().setName("actionImportName").setEntitySet(target.toString());
String target = "nonExisting";
ActionImport providerActionImport = new ActionImport().setName("actionImportName").setEntitySet(target);
EdmProviderImpl edm = mock(EdmProviderImpl.class);
when(edm.getEntityContainer(null)).thenReturn(container);
EdmActionImport actionImport = new EdmActionImportImpl(edm, container, providerActionImport);

View File

@ -65,7 +65,7 @@ public class EdmComplexTypeImplTest {
.setNavigationProperties(baseNavigationProperties);
when(provider.getComplexType(baseName)).thenReturn(baseComplexType);
baseType = EdmComplexTypeImpl.getInstance(edm, baseName, baseComplexType);
baseType = new EdmComplexTypeImpl(edm, baseName, baseComplexType);
FullQualifiedName name = new FullQualifiedName("namespace", "typeName");
ComplexType complexType = new ComplexType().setBaseType(baseName);
@ -77,14 +77,14 @@ public class EdmComplexTypeImplTest {
.setNavigationProperties(navigationProperties);
when(provider.getComplexType(name)).thenReturn(complexType);
type = EdmComplexTypeImpl.getInstance(edm, name, complexType);
type = new EdmComplexTypeImpl(edm, name, complexType);
}
@Test
public void noPropertiesAndNoNavPropertiesMustNotResultInException() {
EdmProviderImpl edm = mock(EdmProviderImpl.class);
ComplexType complexType = new ComplexType().setName("n");
EdmComplexTypeImpl.getInstance(edm, new FullQualifiedName("n", "n"), complexType);
new EdmComplexTypeImpl(edm, new FullQualifiedName("n", "n"), complexType);
}
@Test
@ -163,7 +163,7 @@ public class EdmComplexTypeImplTest {
complexTypeForNonexistingBaseType.setName("typeName");
when(provider.getComplexType(typeWithNonexistingBaseTypeName)).thenReturn(complexTypeForNonexistingBaseType);
EdmComplexTypeImpl instance =
EdmComplexTypeImpl.getInstance(edm, typeWithNonexistingBaseTypeName, complexTypeForNonexistingBaseType);
new EdmComplexTypeImpl(edm, typeWithNonexistingBaseTypeName, complexTypeForNonexistingBaseType);
instance.getBaseType();
}
}

View File

@ -71,21 +71,10 @@ public class EdmEntityContainerImplTest {
@Test
public void getAllEntitySetsAfterOneWasAlreadyLoaded() {
EdmEntitySet entitySet = container.getEntitySet("entitySetName");
container.getEntitySet("entitySetName");
List<EdmEntitySet> entitySets = container.getEntitySets();
assertNotNull(entitySets);
assertEquals(2, entitySets.size());
boolean contained = false;
for (EdmEntitySet es : entitySets) {
// Already loaded entity set must be the same
if (es.getName().equals("entitySetName")) {
assertTrue(entitySet == es);
contained = true;
}
}
if (!contained) {
fail("Should have found entity set in this list.");
}
}
@Test
@ -97,21 +86,10 @@ public class EdmEntityContainerImplTest {
@Test
public void getAllSingletonsAfterOneWasAlreadyLoaded() {
EdmSingleton singleton = container.getSingleton("singletonName");
container.getSingleton("singletonName");
List<EdmSingleton> singletons = container.getSingletons();
assertNotNull(singletons);
assertEquals(2, singletons.size());
boolean contained = false;
for (EdmSingleton s : singletons) {
// Already loaded singleton must be the same
if (s.getName().equals("singletonName")) {
assertTrue(singleton == s);
contained = true;
}
}
if (!contained) {
fail("Should have found singleton in this list.");
}
}
@Test
@ -123,21 +101,10 @@ public class EdmEntityContainerImplTest {
@Test
public void getAllActionImportsAfterOneWasAlreadyLoaded() {
EdmActionImport actionImport = container.getActionImport("actionImportName");
container.getActionImport("actionImportName");
List<EdmActionImport> actionImports = container.getActionImports();
assertNotNull(actionImports);
assertEquals(2, actionImports.size());
boolean contained = false;
for (EdmActionImport ai : actionImports) {
// Already loaded action import must be the same
if (ai.getName().equals("actionImportName")) {
assertTrue(actionImport == ai);
contained = true;
}
}
if (!contained) {
fail("Should have found action import in this list.");
}
}
@Test
@ -149,21 +116,10 @@ public class EdmEntityContainerImplTest {
@Test
public void getAllFunctionImportsAfterOneWasAlreadyLoaded() {
EdmFunctionImport functionImport = container.getFunctionImport("functionImportName");
container.getFunctionImport("functionImportName");
List<EdmFunctionImport> functionImports = container.getFunctionImports();
assertNotNull(functionImports);
assertEquals(2, functionImports.size());
boolean contained = false;
for (EdmFunctionImport fi : functionImports) {
// Already loaded function import must be the same
if (fi.getName().equals("functionImportName")) {
assertTrue(functionImport == fi);
contained = true;
}
}
if (!contained) {
fail("Should have found function import in this list.");
}
}
@Test

View File

@ -18,12 +18,18 @@
*/
package org.apache.olingo.server.core.edm.provider;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.util.Arrays;
import org.apache.olingo.commons.api.edm.EdmBindingTarget;
import org.apache.olingo.commons.api.edm.EdmEntityContainer;
import org.apache.olingo.commons.api.edm.EdmEntitySet;
import org.apache.olingo.commons.api.edm.EdmEntityType;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.Target;
import org.apache.olingo.commons.api.edm.provider.EdmProvider;
import org.apache.olingo.commons.api.edm.provider.EntityContainerInfo;
import org.apache.olingo.commons.api.edm.provider.EntitySet;
@ -35,13 +41,6 @@ import org.apache.olingo.commons.core.edm.provider.EdmEntitySetImpl;
import org.apache.olingo.commons.core.edm.provider.EdmProviderImpl;
import org.junit.Test;
import java.util.Arrays;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public class EdmEntitySetImplTest {
@Test
@ -67,7 +66,7 @@ public class EdmEntitySetImplTest {
.setIncludeInServiceDocument(true)
.setNavigationPropertyBindings(Arrays.asList(
new NavigationPropertyBinding().setPath("path")
.setTarget(new Target().setEntityContainer(containerName).setTargetName(entitySetName).toString())));
.setTarget(containerName.getFullQualifiedNameAsString() + "/" + entitySetName)));
when(provider.getEntitySet(containerName, entitySetName)).thenReturn(entitySetProvider);
final EdmEntitySet entitySet = new EdmEntitySetImpl(edm, entityContainer, entitySetProvider);

View File

@ -76,7 +76,7 @@ public class EdmEntityTypeImplTest {
baseType.setNavigationProperties(navigationProperties);
when(provider.getEntityType(baseName)).thenReturn(baseType);
this.baseType = EdmEntityTypeImpl.getInstance(edm, baseName, baseType);
this.baseType = new EdmEntityTypeImpl(edm, baseName, baseType);
FullQualifiedName typeName = new FullQualifiedName("namespace", "typeName");
EntityType type = new EntityType();
@ -93,7 +93,7 @@ public class EdmEntityTypeImplTest {
type.setNavigationProperties(typeNavigationProperties);
when(provider.getEntityType(typeName)).thenReturn(type);
typeWithBaseType = EdmEntityTypeImpl.getInstance(edm, typeName, type);
typeWithBaseType = new EdmEntityTypeImpl(edm, typeName, type);
FullQualifiedName typeWithComplexKeyName = new FullQualifiedName("namespace", "typeName");
EntityType typeWithComplexKeyProvider = new EntityType();
@ -117,7 +117,7 @@ public class EdmEntityTypeImplTest {
typeWithComplexKeyProvider.setKey(keyForTypeWithComplexKey);
when(provider.getEntityType(typeWithComplexKeyName)).thenReturn(typeWithComplexKeyProvider);
typeWithComplexKey = EdmEntityTypeImpl.getInstance(edm, typeWithComplexKeyName, typeWithComplexKeyProvider);
typeWithComplexKey = new EdmEntityTypeImpl(edm, typeWithComplexKeyName, typeWithComplexKeyProvider);
}
@Test
@ -137,7 +137,7 @@ public class EdmEntityTypeImplTest {
baseType.setNavigationProperties(navigationProperties);
when(provider.getEntityType(baseName)).thenReturn(baseType);
baseType.setAbstract(true);
EdmEntityType edmAbstarctBaseType = EdmEntityTypeImpl.getInstance(edm, baseName, baseType);
EdmEntityType edmAbstarctBaseType = new EdmEntityTypeImpl(edm, baseName, baseType);
assertEquals(2, edmAbstarctBaseType.getPropertyNames().size());
assertEquals("Id", edmAbstarctBaseType.getPropertyNames().get(0));
@ -161,7 +161,7 @@ public class EdmEntityTypeImplTest {
type.setNavigationProperties(typeNavigationProperties);
when(provider.getEntityType(typeName)).thenReturn(type);
EdmEntityType edmType = EdmEntityTypeImpl.getInstance(edm, typeName, type);
EdmEntityType edmType = new EdmEntityTypeImpl(edm, typeName, type);
assertNotNull(edmType.getBaseType());
assertEquals(2, edmAbstarctBaseType.getPropertyNames().size());
@ -200,7 +200,7 @@ public class EdmEntityTypeImplTest {
baseType.setNavigationProperties(navigationProperties);
when(provider.getEntityType(baseName)).thenReturn(baseType);
baseType.setAbstract(true);
EdmEntityType edmAbstarctBaseType = EdmEntityTypeImpl.getInstance(edm, baseName, baseType);
EdmEntityType edmAbstarctBaseType = new EdmEntityTypeImpl(edm, baseName, baseType);
FullQualifiedName typeName = new FullQualifiedName("namespace", "typeName");
EntityType type = new EntityType();
@ -216,7 +216,7 @@ public class EdmEntityTypeImplTest {
typeNavigationProperties.add(new NavigationProperty().setName("nav2"));
type.setNavigationProperties(typeNavigationProperties);
when(provider.getEntityType(typeName)).thenReturn(type);
EdmEntityType edmType = EdmEntityTypeImpl.getInstance(edm, typeName, type);
EdmEntityType edmType = new EdmEntityTypeImpl(edm, typeName, type);
assertNotNull(edmType.getBaseType());
assertEquals(2, edmAbstarctBaseType.getPropertyNames().size());
@ -304,7 +304,9 @@ public class EdmEntityTypeImplTest {
assertNotNull(keyPropertyRefs);
assertEquals(1, keyPropertyRefs.size());
assertEquals("Id", keyPropertyRefs.get(0).getName());
assertTrue(keyPropertyRefs == typeWithBaseType.getKeyPropertyRefs());
for(int i = 0; i < keyPropertyRefs.size(); i++){
assertEquals(keyPropertyRefs.get(i).getName(), typeWithBaseType.getKeyPropertyRefs().get(i).getName());
}
}
@Test
@ -365,14 +367,14 @@ public class EdmEntityTypeImplTest {
public void abstractTypeDoesNotNeedKey() {
EdmProviderImpl edm = mock(EdmProviderImpl.class);
EntityType entityType = new EntityType().setName("n").setAbstract(true);
EdmEntityTypeImpl.getInstance(edm, new FullQualifiedName("n", "n"), entityType);
new EdmEntityTypeImpl(edm, new FullQualifiedName("n", "n"), entityType);
}
@Test(expected = EdmException.class)
public void invalidBaseType() {
EdmProviderImpl edm = mock(EdmProviderImpl.class);
EntityType entityType = new EntityType().setName("n").setBaseType(new FullQualifiedName("wrong", "wrong"));
EdmEntityTypeImpl instance = EdmEntityTypeImpl.getInstance(edm, new FullQualifiedName("n", "n"), entityType);
EdmEntityTypeImpl instance = new EdmEntityTypeImpl(edm, new FullQualifiedName("n", "n"), entityType);
instance.getBaseType();
}
@ -383,7 +385,7 @@ public class EdmEntityTypeImplTest {
FullQualifiedName baseName = new FullQualifiedName("n", "base");
when(provider.getEntityType(baseName)).thenReturn(new EntityType().setName("base").setAbstract(true));
EntityType entityType = new EntityType().setName("n").setAbstract(true).setBaseType(baseName);
EdmEntityTypeImpl.getInstance(edm, new FullQualifiedName("n", "n"), entityType);
new EdmEntityTypeImpl(edm, new FullQualifiedName("n", "n"), entityType);
}
}

View File

@ -46,9 +46,9 @@ public class EdmFunctionImplTest {
EdmProviderImpl provider = mock(EdmProviderImpl.class);
Function function1 = new Function().setReturnType(new ReturnType().setType(new FullQualifiedName("Edm", "String")));
functionImpl1 = EdmFunctionImpl.getInstance(provider, new FullQualifiedName("namespace", "name"), function1);
functionImpl1 = new EdmFunctionImpl(provider, new FullQualifiedName("namespace", "name"), function1);
Function function2 = new Function().setComposable(true);
functionImpl2 = EdmFunctionImpl.getInstance(provider, new FullQualifiedName("namespace", "name"), function2);
functionImpl2 = new EdmFunctionImpl(provider, new FullQualifiedName("namespace", "name"), function2);
}
@Test

View File

@ -18,13 +18,19 @@
*/
package org.apache.olingo.server.core.edm.provider;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.util.Arrays;
import org.apache.olingo.commons.api.edm.EdmBindingTarget;
import org.apache.olingo.commons.api.edm.EdmEntityContainer;
import org.apache.olingo.commons.api.edm.EdmEntityType;
import org.apache.olingo.commons.api.edm.EdmException;
import org.apache.olingo.commons.api.edm.EdmSingleton;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.Target;
import org.apache.olingo.commons.api.edm.provider.EdmProvider;
import org.apache.olingo.commons.api.edm.provider.EntityContainerInfo;
import org.apache.olingo.commons.api.edm.provider.EntityType;
@ -36,13 +42,6 @@ import org.apache.olingo.commons.core.edm.provider.EdmProviderImpl;
import org.apache.olingo.commons.core.edm.provider.EdmSingletonImpl;
import org.junit.Test;
import java.util.Arrays;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public class EdmSingletonImplTest {
@Test
@ -62,12 +61,14 @@ public class EdmSingletonImplTest {
final EdmEntityContainer entityContainer = new EdmEntityContainerImpl(edm, provider, containerInfo);
final String singletonName = "singleton";
final Singleton singletonProvider = new Singleton()
.setName(singletonName)
.setType(typeName)
.setNavigationPropertyBindings(Arrays.asList(
new NavigationPropertyBinding().setPath("path")
.setTarget(new Target().setEntityContainer(containerName).setTargetName(singletonName).toString())));
final Singleton singletonProvider =
new Singleton()
.setName(singletonName)
.setType(typeName)
.setNavigationPropertyBindings(
Arrays.asList(
new NavigationPropertyBinding().setPath("path").setTarget(
containerName.getFullQualifiedNameAsString() + "/" + singletonName)));
when(provider.getSingleton(containerName, singletonName)).thenReturn(singletonProvider);
final EdmSingleton singleton = new EdmSingletonImpl(edm, entityContainer, singletonProvider);
@ -95,7 +96,7 @@ public class EdmSingletonImplTest {
final Singleton singletonProvider = new Singleton()
.setNavigationPropertyBindings(Arrays.asList(
new NavigationPropertyBinding().setPath("path")
.setTarget(new Target().setEntityContainer(containerName).setTargetName("wrong").toString())));
.setTarget(containerName.getFullQualifiedNameAsString() + "/wrong")));
when(provider.getSingleton(containerName, singletonName)).thenReturn(singletonProvider);
final EdmSingleton singleton = new EdmSingletonImpl(edm, null, singletonProvider);
@ -111,9 +112,7 @@ public class EdmSingletonImplTest {
final String singletonName = "singleton";
final Singleton singletonProvider = new Singleton()
.setNavigationPropertyBindings(Arrays.asList(
new NavigationPropertyBinding().setPath("path")
.setTarget(new Target().setEntityContainer(new FullQualifiedName("ns", "wrongContainer"))
.setTargetName(singletonName).toString())));
new NavigationPropertyBinding().setPath("path").setTarget("ns.wrongContainer/" + singletonName)));
when(provider.getSingleton(containerName, singletonName)).thenReturn(singletonProvider);
final EdmSingleton singleton = new EdmSingletonImpl(edm, null, singletonProvider);

View File

@ -62,6 +62,6 @@ public class ComplexTypeHelper {
.setNavigationProperties(navigationProperties);
when(provider.getComplexType(name)).thenReturn(complexType);
return EdmComplexTypeImpl.getInstance(edm, name, complexType);
return new EdmComplexTypeImpl(edm, name, complexType);
}
}

View File

@ -189,7 +189,7 @@ public class ContextURLBuilderTest {
.setNavigationProperties(baseNavigationProperties);
when(provider.getComplexType(baseName)).thenReturn(baseComplexType);
EdmComplexType baseType = EdmComplexTypeImpl.getInstance(edm, baseName, baseComplexType);
EdmComplexType baseType = new EdmComplexTypeImpl(edm, baseName, baseComplexType);
EdmEntitySet entitySet = Mockito.mock(EdmEntitySet.class);
Mockito.when(entitySet.getName()).thenReturn("Customers");

View File

@ -249,7 +249,7 @@ public class MetadataDocumentXmlSerializerTest {
properties.add(new Property().setName("prop2").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName()));
complexType.setProperties(properties);
EdmComplexTypeImpl c1 = EdmComplexTypeImpl.getInstance(edm, name, complexType);
EdmComplexTypeImpl c1 = new EdmComplexTypeImpl(edm, name, complexType);
complexTypes.add(c1);
when(schema.getComplexTypes()).thenReturn(complexTypes);

View File

@ -18,9 +18,12 @@
*/
package org.apache.olingo.server.tecsvc.provider;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.apache.olingo.commons.api.ODataException;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.Target;
import org.apache.olingo.commons.api.edm.provider.ActionImport;
import org.apache.olingo.commons.api.edm.provider.EntityContainer;
import org.apache.olingo.commons.api.edm.provider.EntityContainerInfo;
@ -29,10 +32,6 @@ import org.apache.olingo.commons.api.edm.provider.FunctionImport;
import org.apache.olingo.commons.api.edm.provider.NavigationPropertyBinding;
import org.apache.olingo.commons.api.edm.provider.Singleton;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class ContainerProvider {
public static final FullQualifiedName nameContainer = new FullQualifiedName(SchemaProvider.NAMESPACE, "Container");
@ -158,10 +157,10 @@ public class ContainerProvider {
.setNavigationPropertyBindings(Arrays.asList(
new NavigationPropertyBinding()
.setPath("NavPropertyETTwoPrimOne")
.setTarget(new Target().setTargetName("ESTwoPrim").toString()),
.setTarget("ESTwoPrim"),
new NavigationPropertyBinding()
.setPath("NavPropertyETTwoPrimMany")
.setTarget(new Target().setTargetName("ESTwoPrim").toString())
.setTarget("ESTwoPrim")
));
} else if (name.equals("ESCollAllPrim")) {
@ -176,10 +175,10 @@ public class ContainerProvider {
.setNavigationPropertyBindings(Arrays.asList(
new NavigationPropertyBinding()
.setPath("NavPropertyETAllPrimOne")
.setTarget(new Target().setTargetName("ESAllPrim").toString()),
.setTarget("ESAllPrim"),
new NavigationPropertyBinding()
.setPath("NavPropertyETAllPrimMany")
.setTarget(new Target().setTargetName("ESAllPrim").toString())
.setTarget("ESAllPrim")
));
} else if (name.equals("ESMixPrimCollComp")) {
@ -272,55 +271,55 @@ public class ContainerProvider {
.setNavigationPropertyBindings(Arrays.asList(
new NavigationPropertyBinding()
.setPath("NavPropertyETKeyNavOne")
.setTarget(new Target().setTargetName("ESKeyNav").toString()),
.setTarget("ESKeyNav"),
new NavigationPropertyBinding()
.setPath("NavPropertyETKeyNavMany")
.setTarget(new Target().setTargetName("ESKeyNav").toString()),
.setTarget("ESKeyNav"),
new NavigationPropertyBinding()
.setPath("NavPropertyETTwoKeyNavOne")
.setTarget(new Target().setTargetName("ESTwoKeyNav").toString()),
.setTarget("ESTwoKeyNav"),
new NavigationPropertyBinding()
.setPath("NavPropertyETTwoKeyNavMany")
.setTarget(new Target().setTargetName("ESTwoKeyNav").toString()),
.setTarget("ESTwoKeyNav"),
new NavigationPropertyBinding()
.setPath("NavPropertyETMediaOne")
.setTarget(new Target().setTargetName("ESMedia").toString()),
.setTarget("ESMedia"),
new NavigationPropertyBinding()
.setPath("NavPropertyETMediaMany")
.setTarget(new Target().setTargetName("ESMedia").toString()),
.setTarget("ESMedia"),
new NavigationPropertyBinding()
.setPath("PropertyCompNav/NavPropertyETTwoKeyNavOn")
.setTarget(new Target().setTargetName("ESTwoKeyNav").toString()),
.setTarget("ESTwoKeyNav"),
new NavigationPropertyBinding()
.setPath("PropertyCompNav/NavPropertyETTwoKeyNavMany")
.setTarget(new Target().setTargetName("ESTwoKeyNav").toString()),
.setTarget("ESTwoKeyNav"),
new NavigationPropertyBinding()
.setPath("PropertyCompNav/NavPropertyETMediaOne")
.setTarget(new Target().setTargetName("ESMedia").toString()),
.setTarget("ESMedia"),
new NavigationPropertyBinding()
.setPath("PropertyCompNav/NavPropertyETMediaMany")
.setTarget(new Target().setTargetName("ESMedia").toString()),
.setTarget("ESMedia"),
new NavigationPropertyBinding()
.setPath("PropertyCompCompNav/PropertyCompNav/NavPropertyETTwoKeyNavOne")
.setTarget(new Target().setTargetName("ESTwoKeyNav").toString()),
.setTarget("ESTwoKeyNav"),
new NavigationPropertyBinding()
.setPath("PropertyCompCompNav/PropertyCompNav/NavPropertyETTwoKeyNavMany")
.setTarget(new Target().setTargetName("ESTwoKeyNav").toString()),
.setTarget("ESTwoKeyNav"),
new NavigationPropertyBinding()
.setPath("PropertyCompCompNav/PropertyCompNav/NavPropertyETMediaOne")
.setTarget(new Target().setTargetName("ESMedia").toString()),
.setTarget("ESMedia"),
new NavigationPropertyBinding()
.setPath("PropertyCompCompNav/PropertyCompNav/NavPropertyETMediaMany")
.setTarget(new Target().setTargetName("ESMedia").toString()),
.setTarget("ESMedia"),
new NavigationPropertyBinding()
.setPath("ETKeyNav/PropertyCompNav/NavPropertyETTwoKeyNavMany")
.setTarget(new Target().setTargetName("ESTwoKeyNav").toString()),
.setTarget("ESTwoKeyNav"),
new NavigationPropertyBinding()
.setPath("ETKeyNav/PropertyCompNav/NavPropertyETTwoKeyNavMany")
.setTarget(new Target().setTargetName("ESTwoKeyNav").toString()),
.setTarget("ESTwoKeyNav"),
new NavigationPropertyBinding()
.setPath("PropertyCompNav/com.corp.odata.test1.CTNavFiveProp/NavPropertyETTwoKeyNavMany")
.setTarget(new Target().setTargetName("ESTwoKeyNav").toString())
.setTarget("ESTwoKeyNav")
));
} else if (name.equals("ESTwoKeyNav")) {
@ -330,49 +329,49 @@ public class ContainerProvider {
.setNavigationPropertyBindings(Arrays.asList(
new NavigationPropertyBinding()
.setPath("NavPropertyETKeyNavOne")
.setTarget(new Target().setTargetName("ESKeyNav").toString()),
.setTarget("ESKeyNav"),
new NavigationPropertyBinding()
.setPath("NavPropertyETKeyNavMany")
.setTarget(new Target().setTargetName("ESKeyNav").toString()),
.setTarget("ESKeyNav"),
new NavigationPropertyBinding()
.setPath("NavPropertyETTwoKeyNavOne")
.setTarget(new Target().setTargetName("ESTwoKeyNav").toString()),
.setTarget("ESTwoKeyNav"),
new NavigationPropertyBinding()
.setPath("NavPropertyETTwoKeyNavMany")
.setTarget(new Target().setTargetName("ESTwoKeyNav").toString()),
.setTarget("ESTwoKeyNav"),
new NavigationPropertyBinding()
.setPath("PropertyCompNav/NavPropertyETTwoKeyNavOne")
.setTarget(new Target().setTargetName("ESTwoKeyNav").toString()),
.setTarget("ESTwoKeyNav"),
new NavigationPropertyBinding()
.setPath("PropertyCompNav/NavPropertyETTwoKeyNavMany")
.setTarget(new Target().setTargetName("ESTwoKeyNav").toString()),
.setTarget("ESTwoKeyNav"),
new NavigationPropertyBinding()
.setPath("PropertyCompNav/NavPropertyETKeyNavOne")
.setTarget(new Target().setTargetName("ESKeyNav").toString()),
.setTarget("ESKeyNav"),
new NavigationPropertyBinding()
.setPath("PropertyCompNav/NavPropertyETKeyNavMany")
.setTarget(new Target().setTargetName("ESKeyNav").toString()),
.setTarget("ESKeyNav"),
new NavigationPropertyBinding()
.setPath("CollPropertyCompNav/NavPropertyETTwoKeyNavOne")
.setTarget(new Target().setTargetName("ESTwoKeyNav").toString()),
.setTarget("ESTwoKeyNav"),
new NavigationPropertyBinding()
.setPath("CollPropertyCompNav/NavPropertyETTwoKeyNavMany")
.setTarget(new Target().setTargetName("ESTwoKeyNav").toString()),
.setTarget("ESTwoKeyNav"),
new NavigationPropertyBinding()
.setPath("CollPropertyCompNav/NavPropertyETMediaOne")
.setTarget(new Target().setTargetName("ESMedia").toString()),
.setTarget("ESMedia"),
new NavigationPropertyBinding()
.setPath("CollPropertyCompNav/NavPropertyETMediaMany")
.setTarget(new Target().setTargetName("ESMedia").toString()),
.setTarget("ESMedia"),
new NavigationPropertyBinding()
.setPath("CollPropertyCompNav/NavPropertyETTwoKeyNavMany")
.setTarget(new Target().setTargetName("ESTwoKeyNav").toString()),
.setTarget("ESTwoKeyNav"),
new NavigationPropertyBinding()
.setPath("NavPropertyETTwoBaseTwoKeyNavOne")
.setTarget(new Target().setTargetName("ESBaseTwoKeyNav").toString()),
.setTarget("ESBaseTwoKeyNav"),
new NavigationPropertyBinding()
.setPath("NavPropertySINav")
.setTarget(new Target().setTargetName("SINav").toString())
.setTarget("SINav")
));
} else if (name.equals("ESBaseTwoKeyNav")) {
@ -491,7 +490,7 @@ public class ContainerProvider {
return new FunctionImport()
.setName(name)
.setFunction(FunctionProvider.nameUFCRTETTwoKeyNav)
.setEntitySet(new Target().setEntityContainer(entityContainer).setTargetName("ESTwoKeyNav").toString())
.setEntitySet(entityContainer.getFullQualifiedNameAsString() + "/ESTwoKeyNav")
.setIncludeInServiceDocument(true);
} else if (name.equals("FICRTETTwoKeyNavParam")) {
return new FunctionImport()
@ -539,13 +538,13 @@ public class ContainerProvider {
return new FunctionImport()
.setName(name)
.setFunction(FunctionProvider.nameUFCRTETMedia)
.setEntitySet(new Target().setEntityContainer(entityContainer).setTargetName("ESMedia").toString())
.setEntitySet(entityContainer.getFullQualifiedNameAsString() + "/ESMedia")
.setIncludeInServiceDocument(true);
} else if (name.equals("FICRTCollESMedia")) {
return new FunctionImport()
.setName(name)
.setFunction(FunctionProvider.nameUFCRTCollETMedia)
.setEntitySet(new Target().setEntityContainer(entityContainer).setTargetName("ESMedia").toString())
.setEntitySet(entityContainer.getFullQualifiedNameAsString() + "/ESMedia")
.setIncludeInServiceDocument(true);
} else if (name.equals("FICRTCTTwoPrimParam")) {
@ -576,7 +575,7 @@ public class ContainerProvider {
return new FunctionImport()
.setName(name)
.setFunction(FunctionProvider.nameUFCRTCollETTwoKeyNavParam)
.setEntitySet(new Target().setEntityContainer(entityContainer).setTargetName("ESTwoKeyNav").toString())
.setEntitySet(entityContainer.getFullQualifiedNameAsString() + "/ESTwoKeyNav")
.setIncludeInServiceDocument(true);
} else if (name.equals("FICRTCollCTTwoPrimParam")) {
@ -606,7 +605,7 @@ public class ContainerProvider {
.setNavigationPropertyBindings(Arrays.asList(
new NavigationPropertyBinding()
.setPath("NavPropertyETTwoKeyNavMany")
.setTarget(new Target().setTargetName("ESTwoKeyNav").toString())));
.setTarget("ESTwoKeyNav")));
} else if (name.equals("SIMedia")) {
return new Singleton()

View File

@ -25,7 +25,6 @@ import java.util.List;
import org.apache.olingo.commons.api.ODataException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.Target;
import org.apache.olingo.commons.api.edm.provider.ComplexType;
import org.apache.olingo.commons.api.edm.provider.EdmProvider;
import org.apache.olingo.commons.api.edm.provider.EntityContainer;
@ -122,15 +121,14 @@ public class CarsEdmProvider extends EdmProvider {
.setNavigationPropertyBindings(
Arrays.asList(
new NavigationPropertyBinding().setPath("Manufacturer").setTarget(
new Target().setTargetName(ES_MANUFACTURER_NAME).setEntityContainer(CONTAINER_FQN)
.toString())));
CONTAINER_FQN.getFullQualifiedNameAsString() + "/" + ES_MANUFACTURER_NAME)));
} else if (ES_MANUFACTURER_NAME.equals(entitySetName)) {
return new EntitySet()
.setName(ES_MANUFACTURER_NAME)
.setType(ET_MANUFACTURER).setNavigationPropertyBindings(
Arrays.asList(
new NavigationPropertyBinding().setPath("Cars").setTarget(
new Target().setTargetName(ES_CARS_NAME).setEntityContainer(CONTAINER_FQN).toString())));
new NavigationPropertyBinding().setPath("Cars")
.setTarget(CONTAINER_FQN.getFullQualifiedNameAsString() + "/" + ES_CARS_NAME)));
}
}