[OLINGO-62] Tests and documentation
This commit is contained in:
parent
cf4df9be8a
commit
954ac46aa8
|
@ -1,29 +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.odata4.commons.api.edm.constants;
|
||||
|
||||
/**
|
||||
* EdmConcurrencyMode can be applied to any primitive Entity Data Model (EDM) type.
|
||||
* <p>Possible values are "None", which is the default, and "Fixed".
|
||||
* Fixed implies that the property should be used for optimistic concurrency checks.
|
||||
*/
|
||||
public enum EdmConcurrencyMode {
|
||||
|
||||
None, Fixed;
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
/*******************************************************************************
|
||||
* 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.odata4.commons.api.edm.constants;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* This class is a container for the supported ODataServiceVersions.
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ODataServiceVersion {
|
||||
|
||||
private static final Pattern DATASERVICEVERSIONPATTERN = Pattern.compile("(\\p{Digit}+\\.\\p{Digit}+)(:?;.*)?");
|
||||
|
||||
/**
|
||||
* ODataServiceVersion 1.0
|
||||
*/
|
||||
public static final String V10 = "1.0";
|
||||
/**
|
||||
* ODataServiceVersion 2.0
|
||||
*/
|
||||
public static final String V20 = "2.0";
|
||||
/**
|
||||
* ODataServiceVersion 3.0
|
||||
*/
|
||||
public static final String V30 = "3.0";
|
||||
/**
|
||||
* ODataServiceVersion 4.0
|
||||
*/
|
||||
public static final String V40 = "4.0";
|
||||
|
||||
/**
|
||||
* Validates format and range of a data service version string.
|
||||
* @param version version string
|
||||
* @return <code>true</code> for a valid version
|
||||
*/
|
||||
public static boolean validateDataServiceVersion(final String version) {
|
||||
final Matcher matcher = DATASERVICEVERSIONPATTERN.matcher(version);
|
||||
if (matcher.matches()) {
|
||||
final String possibleDataServiceVersion = matcher.group(1);
|
||||
return V10.equals(possibleDataServiceVersion)
|
||||
|| V20.equals(possibleDataServiceVersion)
|
||||
|| V30.equals(possibleDataServiceVersion)
|
||||
|| V40.equals(possibleDataServiceVersion);
|
||||
} else {
|
||||
throw new IllegalArgumentException(version);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* actual > comparedTo
|
||||
* @param actual
|
||||
* @param comparedTo
|
||||
* @return <code>true</code> if actual is bigger than comparedTo
|
||||
*/
|
||||
public static boolean isBiggerThan(final String actual, final String comparedTo) {
|
||||
if (!validateDataServiceVersion(comparedTo) || !validateDataServiceVersion(actual)) {
|
||||
throw new IllegalArgumentException("Illegal arguments: " + comparedTo + " and " + actual);
|
||||
}
|
||||
|
||||
final double me = Double.parseDouble(extractDataServiceVersionString(actual));
|
||||
final double other = Double.parseDouble(extractDataServiceVersionString(comparedTo));
|
||||
|
||||
return me > other;
|
||||
}
|
||||
|
||||
private static String extractDataServiceVersionString(final String rawDataServiceVersion) {
|
||||
if (rawDataServiceVersion != null) {
|
||||
final String[] pattern = rawDataServiceVersion.split(";");
|
||||
return pattern[0];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -20,7 +20,6 @@ package org.apache.olingo.odata4.commons.api.edm.provider;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
//TODO: Finish
|
||||
public class Action extends Operation {
|
||||
@Override
|
||||
public Action setName(final String name) {
|
||||
|
|
|
@ -20,7 +20,6 @@ package org.apache.olingo.odata4.commons.api.edm.provider;
|
|||
|
||||
import org.apache.olingo.odata4.commons.api.edm.helper.FullQualifiedName;
|
||||
|
||||
//TODO: Finish
|
||||
public class ActionImport extends OperationImport {
|
||||
private FullQualifiedName action;
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@ import java.util.List;
|
|||
|
||||
import org.apache.olingo.odata4.commons.api.edm.helper.FullQualifiedName;
|
||||
|
||||
//TODO:finish
|
||||
public class Annotation {
|
||||
private FullQualifiedName term;
|
||||
// Target should be a target path
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.apache.olingo.odata4.commons.api.edm.helper.EntityContainerInfo;
|
|||
import org.apache.olingo.odata4.commons.api.edm.helper.FullQualifiedName;
|
||||
import org.apache.olingo.odata4.commons.api.exception.ODataException;
|
||||
|
||||
public interface EdmProvider {
|
||||
public abstract class EdmProvider {
|
||||
|
||||
/**
|
||||
* This method should return an {@link EnumType} or <b>null</b> if nothing is found
|
||||
|
@ -33,7 +33,9 @@ public interface EdmProvider {
|
|||
* @return {@link EnumType} for given name
|
||||
* @throws ODataException
|
||||
*/
|
||||
public EnumType getEnumType(final FullQualifiedName enumTypeName) throws ODataException;
|
||||
public EnumType getEnumType(final FullQualifiedName enumTypeName) throws ODataException {
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* This method should return an {@link TypeDefinition} or <b>null</b> if nothing is found
|
||||
|
@ -41,7 +43,9 @@ public interface EdmProvider {
|
|||
* @return {@link TypeDefinition} for given name
|
||||
* @throws ODataException
|
||||
*/
|
||||
public TypeDefinition getTypeDefinition(final FullQualifiedName typeDefinitionName) throws ODataException;
|
||||
public TypeDefinition getTypeDefinition(final FullQualifiedName typeDefinitionName) throws ODataException {
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* This method should return an {@link EntityType} or <b>null</b> if nothing is found
|
||||
|
@ -49,7 +53,9 @@ public interface EdmProvider {
|
|||
* @return {@link EntityType} for the given name
|
||||
* @throws ODataException
|
||||
*/
|
||||
public EntityType getEntityType(final FullQualifiedName entityTypeName) throws ODataException;
|
||||
public EntityType getEntityType(final FullQualifiedName entityTypeName) throws ODataException {
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* This method should return a {@link ComplexType} or <b>null</b> if nothing is found
|
||||
|
@ -57,7 +63,9 @@ public interface EdmProvider {
|
|||
* @return {@link StructuralType} for the given name
|
||||
* @throws ODataException
|
||||
*/
|
||||
public ComplexType getComplexType(final FullQualifiedName complexTypeName) throws ODataException;
|
||||
public ComplexType getComplexType(final FullQualifiedName complexTypeName) throws ODataException {
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* This method should return a list of all {@link Action} for the FullQualifiedname or <b>null</b> if nothing is found
|
||||
|
@ -65,7 +73,9 @@ public interface EdmProvider {
|
|||
* @return List of {@link Action} or null
|
||||
* @throws ODataException
|
||||
*/
|
||||
public List<Action> getActions(final FullQualifiedName actionName) throws ODataException;
|
||||
public List<Action> getActions(final FullQualifiedName actionName) throws ODataException {
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* This method should return a list of all {@link Function} for the FullQualifiedname or <b>null</b> if nothing is
|
||||
|
@ -74,10 +84,14 @@ public interface EdmProvider {
|
|||
* @return List of {@link Function} or null
|
||||
* @throws ODataException
|
||||
*/
|
||||
public List<Function> getFunctions(final FullQualifiedName functionName) throws ODataException;
|
||||
public List<Function> getFunctions(final FullQualifiedName functionName) throws ODataException {
|
||||
return null;
|
||||
};
|
||||
|
||||
// TODO: document
|
||||
public Term getTerm(final FullQualifiedName termName) throws ODataException;
|
||||
public Term getTerm(final FullQualifiedName termName) throws ODataException {
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* This method should return an {@link EntitySet} or <b>null</b> if nothing is found
|
||||
|
@ -87,7 +101,9 @@ public interface EdmProvider {
|
|||
* @throws ODataException
|
||||
*/
|
||||
public EntitySet getEntitySet(final FullQualifiedName entityContainer, final String entitySetName)
|
||||
throws ODataException;
|
||||
throws ODataException {
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* This method should return an {@link Singleton} or <b>null</b> if nothing is found
|
||||
|
@ -97,7 +113,9 @@ public interface EdmProvider {
|
|||
* @throws ODataException
|
||||
*/
|
||||
public Singleton getSingleton(final FullQualifiedName entityContainer, final String singletonName)
|
||||
throws ODataException;
|
||||
throws ODataException {
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* This method should return an {@link ActionImport} or <b>null</b> if nothing is found
|
||||
|
@ -107,7 +125,9 @@ public interface EdmProvider {
|
|||
* @throws ODataException
|
||||
*/
|
||||
public ActionImport getActionImport(final FullQualifiedName entityContainer, final String actionImportName)
|
||||
throws ODataException;
|
||||
throws ODataException {
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* This method should return a {@link FunctionImport} or <b>null</b> if nothing is found
|
||||
|
@ -117,7 +137,9 @@ public interface EdmProvider {
|
|||
* @throws ODataException
|
||||
*/
|
||||
public FunctionImport getFunctionImport(final FullQualifiedName entityContainer, final String functionImportName)
|
||||
throws ODataException;
|
||||
throws ODataException {
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* This method should return an {@link EntityContainerInfo} or <b>null</b> if nothing is found
|
||||
|
@ -125,19 +147,25 @@ public interface EdmProvider {
|
|||
* @return {@link EntityContainerInfo} for the given name
|
||||
* @throws ODataException
|
||||
*/
|
||||
public EntityContainerInfo getEntityContainerInfo(final FullQualifiedName entityContainerName) throws ODataException;
|
||||
public EntityContainerInfo getEntityContainerInfo(final FullQualifiedName entityContainerName) throws ODataException {
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* This method should return a list of all namespaces which have an alias
|
||||
* @return List of alias info
|
||||
* @throws ODataException
|
||||
*/
|
||||
public List<AliasInfo> getAliasInfos() throws ODataException;
|
||||
public List<AliasInfo> getAliasInfos() throws ODataException {
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* This method should return a collection of all {@link Schema}
|
||||
* @return List<{@link Schema}>
|
||||
* @throws ODataException
|
||||
*/
|
||||
public List<Schema> getSchemas() throws ODataException;
|
||||
public List<Schema> getSchemas() throws ODataException {
|
||||
return null;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,106 +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.odata4.commons.api.edm.provider;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.olingo.odata4.commons.api.edm.helper.AliasInfo;
|
||||
import org.apache.olingo.odata4.commons.api.edm.helper.EntityContainerInfo;
|
||||
import org.apache.olingo.odata4.commons.api.edm.helper.FullQualifiedName;
|
||||
import org.apache.olingo.odata4.commons.api.exception.ODataException;
|
||||
|
||||
//TODO: Finish
|
||||
/**
|
||||
* Default EDM Provider which is to be extended by the application
|
||||
*/
|
||||
public abstract class EdmProviderAdapter implements EdmProvider {
|
||||
|
||||
@Override
|
||||
public EnumType getEnumType(final FullQualifiedName enumTypeName) throws ODataException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypeDefinition getTypeDefinition(final FullQualifiedName typeDefinitionName) throws ODataException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityType getEntityType(final FullQualifiedName entityTypeName) throws ODataException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ComplexType getComplexType(final FullQualifiedName complexTypeName) throws ODataException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Action> getActions(final FullQualifiedName actionName) throws ODataException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Function> getFunctions(final FullQualifiedName functionName) throws ODataException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Term getTerm(final FullQualifiedName termName) throws ODataException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntitySet getEntitySet(final FullQualifiedName entityContainer, final String name) throws ODataException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Singleton getSingleton(final FullQualifiedName entityContainer, final String name) throws ODataException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionImport getActionImport(final FullQualifiedName entityContainer, final String name) throws ODataException
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FunctionImport getFunctionImport(final FullQualifiedName entityContainer, final String name)
|
||||
throws ODataException {
|
||||
return null;
|
||||
}
|
||||
|
||||
// There are no other containers
|
||||
@Override
|
||||
public EntityContainerInfo getEntityContainerInfo(final FullQualifiedName entityContainerName) throws ODataException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AliasInfo> getAliasInfos() throws ODataException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Schema> getSchemas() throws ODataException {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -22,7 +22,6 @@ import java.util.List;
|
|||
|
||||
import org.apache.olingo.odata4.commons.api.edm.helper.FullQualifiedName;
|
||||
|
||||
//TODO: finish
|
||||
public class EntityContainer {
|
||||
|
||||
private String name;
|
||||
|
|
|
@ -22,7 +22,6 @@ import java.util.List;
|
|||
|
||||
import org.apache.olingo.odata4.commons.api.edm.helper.FullQualifiedName;
|
||||
|
||||
//TODO: Finish
|
||||
public class EntitySet extends BindingTarget {
|
||||
|
||||
private boolean includeInServiceDocument;
|
||||
|
|
|
@ -18,8 +18,7 @@
|
|||
******************************************************************************/
|
||||
package org.apache.olingo.odata4.commons.api.edm.provider;
|
||||
|
||||
//TODO: finish
|
||||
//DO we really need this class?
|
||||
//TODO: Do we really need this class?
|
||||
public class EntitySetPath {
|
||||
|
||||
private String bindingParameter;
|
||||
|
|
|
@ -22,9 +22,8 @@ import java.util.List;
|
|||
|
||||
import org.apache.olingo.odata4.commons.api.edm.helper.FullQualifiedName;
|
||||
|
||||
//TODO: Finish
|
||||
public class EntityType extends StructuralType {
|
||||
// Anything except which have to be new?
|
||||
|
||||
private List<PropertyRef> key;
|
||||
private boolean hasStream;
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
******************************************************************************/
|
||||
package org.apache.olingo.odata4.commons.api.edm.provider;
|
||||
|
||||
//TODO: Finish
|
||||
public class EnumMember {
|
||||
|
||||
private String name;
|
||||
|
|
|
@ -22,7 +22,6 @@ import java.util.List;
|
|||
|
||||
import org.apache.olingo.odata4.commons.api.edm.helper.FullQualifiedName;
|
||||
|
||||
//TODO: Finish
|
||||
public class EnumType {
|
||||
|
||||
private String name;
|
||||
|
|
|
@ -20,7 +20,6 @@ package org.apache.olingo.odata4.commons.api.edm.provider;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
//TODO: Finish
|
||||
public class Function extends Operation {
|
||||
|
||||
private boolean isComposable;
|
||||
|
|
|
@ -20,7 +20,6 @@ package org.apache.olingo.odata4.commons.api.edm.provider;
|
|||
|
||||
import org.apache.olingo.odata4.commons.api.edm.helper.FullQualifiedName;
|
||||
|
||||
//TODO: Finish
|
||||
public class FunctionImport extends OperationImport {
|
||||
|
||||
private FullQualifiedName function;
|
||||
|
|
|
@ -23,14 +23,12 @@ import java.util.List;
|
|||
import org.apache.olingo.odata4.commons.api.edm.constants.EdmOnDelete;
|
||||
import org.apache.olingo.odata4.commons.api.edm.helper.FullQualifiedName;
|
||||
|
||||
//TODO: finish
|
||||
public class NavigationProperty {
|
||||
|
||||
private String name;
|
||||
private FullQualifiedName type;
|
||||
private boolean isCollection;
|
||||
|
||||
// Should we make the partner a path class?
|
||||
private String partner;
|
||||
private boolean containsTarget;
|
||||
private List<ReferentialConstraint> referentialConstraints;
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
******************************************************************************/
|
||||
package org.apache.olingo.odata4.commons.api.edm.provider;
|
||||
|
||||
//TODO: finish
|
||||
public class NavigationPropertyBinding {
|
||||
|
||||
private String path;
|
||||
|
|
|
@ -20,7 +20,6 @@ package org.apache.olingo.odata4.commons.api.edm.provider;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
//TODO: finish
|
||||
public abstract class Operation {
|
||||
|
||||
protected String name;
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
******************************************************************************/
|
||||
package org.apache.olingo.odata4.commons.api.edm.provider;
|
||||
|
||||
//TODO: finish
|
||||
public abstract class OperationImport {
|
||||
|
||||
protected String name;
|
||||
|
|
|
@ -20,7 +20,6 @@ package org.apache.olingo.odata4.commons.api.edm.provider;
|
|||
|
||||
import org.apache.olingo.odata4.commons.api.edm.helper.FullQualifiedName;
|
||||
|
||||
//TODO: finish
|
||||
public class Parameter {
|
||||
|
||||
private String name;
|
||||
|
|
|
@ -20,7 +20,6 @@ package org.apache.olingo.odata4.commons.api.edm.provider;
|
|||
|
||||
import org.apache.olingo.odata4.commons.api.edm.helper.FullQualifiedName;
|
||||
|
||||
//TODO: Finish
|
||||
public class Property {
|
||||
|
||||
private String name;
|
||||
|
@ -28,7 +27,7 @@ public class Property {
|
|||
private FullQualifiedName type;
|
||||
private boolean collection;
|
||||
|
||||
// Mimetype and mapping what here
|
||||
//TODO: Mimetype and mapping what here
|
||||
private String mimeType;
|
||||
private Mapping mapping;
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
******************************************************************************/
|
||||
package org.apache.olingo.odata4.commons.api.edm.provider;
|
||||
|
||||
//TODO: finish
|
||||
public class ReferentialConstraint {
|
||||
|
||||
// TODO: check data type
|
||||
|
|
|
@ -20,7 +20,6 @@ package org.apache.olingo.odata4.commons.api.edm.provider;
|
|||
|
||||
import org.apache.olingo.odata4.commons.api.edm.helper.FullQualifiedName;
|
||||
|
||||
//TODDO: finish
|
||||
public class ReturnType {
|
||||
|
||||
private FullQualifiedName type;
|
||||
|
|
|
@ -20,7 +20,6 @@ package org.apache.olingo.odata4.commons.api.edm.provider;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
//TODO: Finish
|
||||
public class Schema {
|
||||
|
||||
private String namespace;
|
||||
|
|
|
@ -22,7 +22,6 @@ import java.util.List;
|
|||
|
||||
import org.apache.olingo.odata4.commons.api.edm.helper.FullQualifiedName;
|
||||
|
||||
//TODO: Finish
|
||||
public class Singleton extends BindingTarget {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -22,7 +22,6 @@ import java.util.List;
|
|||
|
||||
import org.apache.olingo.odata4.commons.api.edm.helper.FullQualifiedName;
|
||||
|
||||
//TODO: Finish
|
||||
public abstract class StructuralType {
|
||||
|
||||
protected String name;
|
||||
|
|
|
@ -22,7 +22,6 @@ import org.apache.olingo.odata4.commons.api.edm.helper.FullQualifiedName;
|
|||
|
||||
public class Target {
|
||||
|
||||
// What is the name here?
|
||||
private String targetName;
|
||||
private FullQualifiedName entityContainer;
|
||||
|
||||
|
|
|
@ -22,12 +22,11 @@ import java.util.List;
|
|||
|
||||
import org.apache.olingo.odata4.commons.api.edm.helper.FullQualifiedName;
|
||||
|
||||
//TODO: Finish
|
||||
public class Term {
|
||||
private String name;
|
||||
private FullQualifiedName type;
|
||||
private FullQualifiedName baseTerm;
|
||||
// AppliesTo is a list of csdl elements => should we put this list inside an enum?
|
||||
//TODO: AppliesTo is a list of csdl elements => should we put this list inside an enum?
|
||||
private String appliesTo;
|
||||
private boolean isCollection;
|
||||
|
||||
|
|
|
@ -20,11 +20,10 @@ package org.apache.olingo.odata4.commons.api.edm.provider;
|
|||
|
||||
import org.apache.olingo.odata4.commons.api.edm.helper.FullQualifiedName;
|
||||
|
||||
//TODO: Finish
|
||||
public class TypeDefinition {
|
||||
|
||||
private String name;
|
||||
// UnderlyingType can only be primitve...
|
||||
// TODO: UnderlyingType can only be primitve...
|
||||
private FullQualifiedName underlyingType;
|
||||
|
||||
// Facets
|
||||
|
|
|
@ -37,6 +37,7 @@ public class EdmEntityTypeImpl extends EdmStructuralTypeImpl implements EdmEntit
|
|||
private final List<String> keyPredicateNames = new ArrayList<String>();
|
||||
private final HashMap<String, EdmKeyPropertyRef> keyPropertyRefs = new HashMap<String, EdmKeyPropertyRef>();
|
||||
private final EdmEntityType entityBaseType;
|
||||
private ArrayList<EdmKeyPropertyRef> keyPropertyRefsList;
|
||||
|
||||
public EdmEntityTypeImpl(final EdmProviderImpl edm, final FullQualifiedName name, final EntityType entityType) {
|
||||
super(edm, name, entityType, EdmTypeKind.ENTITY);
|
||||
|
@ -86,8 +87,10 @@ public class EdmEntityTypeImpl extends EdmStructuralTypeImpl implements EdmEntit
|
|||
if (baseType != null) {
|
||||
return entityBaseType.getKeyPropertyRefs();
|
||||
} else {
|
||||
// TODO: Cache
|
||||
return new ArrayList<EdmKeyPropertyRef>(keyPropertyRefs.values());
|
||||
if(keyPropertyRefsList == null){
|
||||
keyPropertyRefsList = new ArrayList<EdmKeyPropertyRef>(keyPropertyRefs.values());
|
||||
}
|
||||
return keyPropertyRefsList;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -106,7 +109,7 @@ public class EdmEntityTypeImpl extends EdmStructuralTypeImpl implements EdmEntit
|
|||
if (baseTypeName != null) {
|
||||
baseType = edm.getEntityType(baseTypeName);
|
||||
if (baseType == null) {
|
||||
throw new EdmException("Cant find base type with name: " + baseTypeName + " for entity type: " + getName());
|
||||
throw new EdmException("Cannot find base type with name: " + baseTypeName + " for entity type: " + getName());
|
||||
}
|
||||
}
|
||||
return baseType;
|
||||
|
|
|
@ -18,7 +18,9 @@
|
|||
******************************************************************************/
|
||||
package org.apache.olingo.odata4.commons.core.edm.provider;
|
||||
|
||||
import org.apache.olingo.odata4.commons.api.edm.EdmException;
|
||||
import org.apache.olingo.odata4.commons.api.edm.EdmFunction;
|
||||
import org.apache.olingo.odata4.commons.api.edm.EdmReturnType;
|
||||
import org.apache.olingo.odata4.commons.api.edm.constants.EdmTypeKind;
|
||||
import org.apache.olingo.odata4.commons.api.edm.helper.FullQualifiedName;
|
||||
import org.apache.olingo.odata4.commons.api.edm.provider.Function;
|
||||
|
@ -37,4 +39,13 @@ public class EdmFunctionImpl extends EdmOperationImpl implements EdmFunction {
|
|||
return function.isComposable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EdmReturnType getReturnType() {
|
||||
EdmReturnType returnType = super.getReturnType();
|
||||
if (returnType == null) {
|
||||
throw new EdmException("ReturnType for a function must not be null");
|
||||
}
|
||||
return returnType;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,12 +23,15 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.olingo.odata4.commons.api.edm.EdmBindingTarget;
|
||||
import org.apache.olingo.odata4.commons.api.edm.EdmEntitySet;
|
||||
import org.apache.olingo.odata4.commons.api.edm.EdmException;
|
||||
import org.apache.olingo.odata4.commons.api.edm.EdmOperation;
|
||||
import org.apache.olingo.odata4.commons.api.edm.EdmParameter;
|
||||
import org.apache.olingo.odata4.commons.api.edm.EdmReturnType;
|
||||
import org.apache.olingo.odata4.commons.api.edm.constants.EdmTypeKind;
|
||||
import org.apache.olingo.odata4.commons.api.edm.helper.FullQualifiedName;
|
||||
import org.apache.olingo.odata4.commons.api.edm.provider.EntitySetPath;
|
||||
import org.apache.olingo.odata4.commons.api.edm.provider.Operation;
|
||||
import org.apache.olingo.odata4.commons.api.edm.provider.Parameter;
|
||||
|
||||
|
@ -72,13 +75,31 @@ public class EdmOperationImpl extends EdmTypeImpl implements EdmOperation {
|
|||
|
||||
@Override
|
||||
public EdmEntitySet getReturnedEntitySet(final EdmEntitySet bindingParameterEntitySet, final String path) {
|
||||
// TODO: What here?
|
||||
return null;
|
||||
EntitySetPath entitySetPath = operation.getEntitySetPath();
|
||||
EdmEntitySet returnedEntitySet = null;
|
||||
if (bindingParameterEntitySet != null && entitySetPath != null && entitySetPath.getBindingParameter() != null
|
||||
&& entitySetPath.getPath() != null) {
|
||||
String finalPath = "";
|
||||
if (path != null) {
|
||||
finalPath = path + "/" + entitySetPath.getPath();
|
||||
} else {
|
||||
finalPath = entitySetPath.getPath();
|
||||
}
|
||||
|
||||
EdmBindingTarget relatedBindingTarget = bindingParameterEntitySet.getRelatedBindingTarget(finalPath);
|
||||
if (relatedBindingTarget instanceof EdmEntitySet) {
|
||||
returnedEntitySet = (EdmEntitySet) relatedBindingTarget;
|
||||
} else {
|
||||
throw new EdmException("BindingTarget with name: " + relatedBindingTarget.getName() + " must be an entity set");
|
||||
}
|
||||
}
|
||||
|
||||
return returnedEntitySet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EdmReturnType getReturnType() {
|
||||
if (returnType == null) {
|
||||
if (returnType == null && operation.getReturnType() != null) {
|
||||
returnType = new EdmReturnTypeImpl(edm, operation.getReturnType());
|
||||
}
|
||||
return returnType;
|
||||
|
|
|
@ -52,7 +52,7 @@ public class EdmPropertyImpl extends EdmElementImpl implements EdmProperty {
|
|||
if (kind != null) {
|
||||
propertyType = kind.getEdmPrimitiveTypeInstance();
|
||||
} else {
|
||||
throw new EdmException("Can<EFBFBD>t find type with name: " + typeName);
|
||||
throw new EdmException("Cannot find type with name: " + typeName);
|
||||
}
|
||||
} else {
|
||||
propertyType = edm.getComplexType(typeName);
|
||||
|
@ -61,7 +61,7 @@ public class EdmPropertyImpl extends EdmElementImpl implements EdmProperty {
|
|||
if (propertyType == null) {
|
||||
propertyType = edm.getTypeDefinition(typeName);
|
||||
if (propertyType == null) {
|
||||
throw new EdmException("Can<EFBFBD>t find type with name: " + typeName);
|
||||
throw new EdmException("Cannot find type with name: " + typeName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ import java.io.InputStream;
|
|||
import java.util.List;
|
||||
|
||||
import org.apache.olingo.odata4.commons.api.edm.EdmServiceMetadata;
|
||||
import org.apache.olingo.odata4.commons.api.edm.constants.ODataServiceVersion;
|
||||
import org.apache.olingo.odata4.commons.api.edm.helper.EdmEntitySetInfo;
|
||||
import org.apache.olingo.odata4.commons.api.edm.helper.EdmFunctionImportInfo;
|
||||
import org.apache.olingo.odata4.commons.api.edm.helper.EdmSingletonInfo;
|
||||
|
@ -38,8 +39,7 @@ public class EdmServiceMetadataImpl implements EdmServiceMetadata {
|
|||
|
||||
@Override
|
||||
public String getDataServiceVersion() {
|
||||
// TODO: make constant
|
||||
return "4.0";
|
||||
return ODataServiceVersion.V40;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -50,8 +50,6 @@ public class EdmImplCachingTest {
|
|||
private final FullQualifiedName NAME2 = new FullQualifiedName("testNamespace2", "testName2");
|
||||
private Edm edm;
|
||||
|
||||
// TODO: Test with alias
|
||||
|
||||
@Test
|
||||
public void cacheEntityContainer() {
|
||||
EdmEntityContainer entityContainer = edm.getEntityContainer(null);
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.apache.olingo.odata4.commons.api.edm.helper.FullQualifiedName;
|
|||
import org.apache.olingo.odata4.commons.api.edm.provider.Action;
|
||||
import org.apache.olingo.odata4.commons.api.edm.provider.ActionImport;
|
||||
import org.apache.olingo.odata4.commons.api.edm.provider.ComplexType;
|
||||
import org.apache.olingo.odata4.commons.api.edm.provider.EdmProviderAdapter;
|
||||
import org.apache.olingo.odata4.commons.api.edm.provider.EdmProvider;
|
||||
import org.apache.olingo.odata4.commons.api.edm.provider.EntitySet;
|
||||
import org.apache.olingo.odata4.commons.api.edm.provider.EntityType;
|
||||
import org.apache.olingo.odata4.commons.api.edm.provider.EnumMember;
|
||||
|
@ -43,7 +43,7 @@ import org.apache.olingo.odata4.commons.api.edm.provider.Singleton;
|
|||
import org.apache.olingo.odata4.commons.api.exception.ODataException;
|
||||
import org.apache.olingo.odata4.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
|
||||
|
||||
public class EdmTechProvider extends EdmProviderAdapter {
|
||||
public class EdmTechProvider extends EdmProvider {
|
||||
|
||||
public static final String nameSpace = "com.sap.odata.test1";
|
||||
|
||||
|
|
Loading…
Reference in New Issue