[OLINGO-62] Further implementation
This commit is contained in:
parent
2e622040d1
commit
7b1726a2f9
|
@ -50,13 +50,16 @@ public abstract class EdmBindingTargetImpl extends EdmNamedImpl implements EdmBi
|
|||
Target providerTarget = binding.getTarget();
|
||||
EdmEntityContainer entityContainer = edm.getEntityContainer(providerTarget.getEntityContainer());
|
||||
if (entityContainer == null) {
|
||||
throw new EdmException("Can´t find entity container with name: " + providerTarget.getEntityContainer());
|
||||
throw new EdmException("Cant find entity container with name: " + providerTarget.getEntityContainer());
|
||||
}
|
||||
bindingTarget = entityContainer.getEntitySet(providerTarget.getTargetName());
|
||||
String targetName = providerTarget.getTargetName();
|
||||
bindingTarget = entityContainer.getEntitySet(targetName);
|
||||
if (bindingTarget == null) {
|
||||
bindingTarget = entityContainer.getSingleton(providerTarget.getTargetName());
|
||||
bindingTarget = entityContainer.getSingleton(targetName);
|
||||
if (bindingTarget != null) {
|
||||
break;
|
||||
}else{
|
||||
throw new EdmException("Cant find target with name: " + targetName);
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
|
|
|
@ -42,7 +42,7 @@ public class EdmComplexTypeImpl extends EdmStructuralTypeImpl implements EdmComp
|
|||
if (baseTypeName != null) {
|
||||
baseType = edm.getComplexType(baseTypeName);
|
||||
if (baseType == null) {
|
||||
throw new EdmException("Can<EFBFBD>t find base type with name: " + baseTypeName + " for complex type: " + getName());
|
||||
throw new EdmException("Cant find base type with name: " + baseTypeName + " for complex type: " + getName());
|
||||
}
|
||||
}
|
||||
return baseType;
|
||||
|
|
|
@ -26,7 +26,6 @@ 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.EdmFunctionImport;
|
||||
import org.apache.olingo.commons.api.edm.EdmNamed;
|
||||
import org.apache.olingo.commons.api.edm.EdmSingleton;
|
||||
import org.apache.olingo.commons.api.edm.helper.EntityContainerInfo;
|
||||
import org.apache.olingo.commons.api.edm.helper.FullQualifiedName;
|
||||
|
|
|
@ -86,6 +86,7 @@ public class EdmEntityTypeImpl extends EdmStructuralTypeImpl implements EdmEntit
|
|||
if (baseType != null) {
|
||||
return entityBaseType.getKeyPropertyRefs();
|
||||
} else {
|
||||
//TODO: Cache
|
||||
return new ArrayList<EdmKeyPropertyRef>(keyPropertyRefs.values());
|
||||
}
|
||||
}
|
||||
|
@ -105,7 +106,7 @@ public class EdmEntityTypeImpl extends EdmStructuralTypeImpl implements EdmEntit
|
|||
if (baseTypeName != null) {
|
||||
baseType = edm.getEntityType(baseTypeName);
|
||||
if (baseType == null) {
|
||||
throw new EdmException("Can<EFBFBD>t find base type with name: " + baseTypeName + " for entity type: " + getName());
|
||||
throw new EdmException("Cant find base type with name: " + baseTypeName + " for entity type: " + getName());
|
||||
}
|
||||
}
|
||||
return baseType;
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
/*******************************************************************************
|
||||
* 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.EdmMember;
|
||||
import org.apache.olingo.commons.api.edm.provider.EnumMember;
|
||||
|
||||
public class EdmMemberImpl extends EdmNamedImpl implements EdmMember {
|
||||
|
||||
private final EnumMember member;
|
||||
|
||||
public EdmMemberImpl(EdmProviderImpl edm, EnumMember member) {
|
||||
super(edm, member.getName());
|
||||
this.member = member;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
return member.getValue();
|
||||
}
|
||||
|
||||
}
|
|
@ -18,7 +18,10 @@
|
|||
******************************************************************************/
|
||||
package org.apache.olingo.commons.core.edm.provider;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.olingo.commons.api.edm.EdmEntitySet;
|
||||
import org.apache.olingo.commons.api.edm.EdmOperation;
|
||||
|
@ -27,37 +30,63 @@ import org.apache.olingo.commons.api.edm.EdmReturnType;
|
|||
import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
|
||||
import org.apache.olingo.commons.api.edm.helper.FullQualifiedName;
|
||||
import org.apache.olingo.commons.api.edm.provider.Operation;
|
||||
import org.apache.olingo.commons.api.edm.provider.Parameter;
|
||||
|
||||
public class EdmOperationImpl extends EdmTypeImpl implements EdmOperation {
|
||||
|
||||
private final Map<String, EdmParameter> parameters = new HashMap<String, EdmParameter>();
|
||||
private final Operation operation;
|
||||
private EdmReturnType returnType;
|
||||
private List<String> parameterNames;
|
||||
|
||||
public EdmOperationImpl(final EdmProviderImpl edm, final FullQualifiedName name, final Operation operation,
|
||||
final EdmTypeKind kind) {
|
||||
super(edm, name, kind);
|
||||
this.operation = operation;
|
||||
List<Parameter> providerParameters = operation.getParameters();
|
||||
if (providerParameters != null) {
|
||||
for (Parameter parameter : providerParameters) {
|
||||
parameters.put(parameter.getName(), new EdmParameterImpl(edm, parameter));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EdmParameter getParameter(final String name) {
|
||||
return null;
|
||||
return parameters.get(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getParameterNames() {
|
||||
return null;
|
||||
if (parameterNames == null) {
|
||||
parameterNames = new ArrayList<String>();
|
||||
List<Parameter> providerParameters = operation.getParameters();
|
||||
if (providerParameters != null) {
|
||||
for (Parameter parameter : providerParameters) {
|
||||
parameterNames.add(parameter.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
return parameterNames;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EdmEntitySet getReturnedEntitySet(final EdmEntitySet bindingParameterEntitySet, final String path) {
|
||||
//TODO: What here?
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EdmReturnType getReturnType() {
|
||||
return null;
|
||||
if (returnType == null) {
|
||||
returnType = new EdmReturnTypeImpl(edm, operation.getReturnType());
|
||||
}
|
||||
return returnType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBound() {
|
||||
return false;
|
||||
return operation.isBound();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ public class EdmParameterImpl extends EdmElementImpl implements EdmParameter {
|
|||
if (kind != null) {
|
||||
typeImpl = kind.getEdmPrimitiveTypeInstance();
|
||||
} else {
|
||||
throw new EdmException("Can<EFBFBD>t find type with name: " + typeName);
|
||||
throw new EdmException("Cant find type with name: " + typeName);
|
||||
}
|
||||
} else {
|
||||
typeImpl = edm.getComplexType(typeName);
|
||||
|
@ -57,7 +57,7 @@ public class EdmParameterImpl extends EdmElementImpl implements EdmParameter {
|
|||
if (typeImpl == null) {
|
||||
typeImpl = edm.getTypeDefinition(typeName);
|
||||
if (typeImpl == null) {
|
||||
throw new EdmException("Can<EFBFBD>t find type with name: " + typeName);
|
||||
throw new EdmException("Cant find type with name: " + typeName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ public class EdmReturnTypeImpl implements EdmReturnType {
|
|||
if (typeImpl == null) {
|
||||
typeImpl = edm.getTypeDefinition(typeName);
|
||||
if (typeImpl == null) {
|
||||
throw new EdmException("Can<EFBFBD>t find type with name: " + typeName);
|
||||
throw new EdmException("Cant find type with name: " + typeName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue