[OLINGO-575] Edm cleanup: Remove EdmAnnotationHelperImpl
This commit is contained in:
parent
4f33c704cf
commit
16b94eb47e
|
@ -1,26 +1,23 @@
|
||||||
/*
|
/*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
* or more contributor license agreements. See the NOTICE file
|
* or more contributor license agreements. See the NOTICE file
|
||||||
* distributed with this work for additional information
|
* distributed with this work for additional information
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
* to you under the Apache License, Version 2.0 (the
|
* to you under the Apache License, Version 2.0 (the
|
||||||
* "License"); you may not use this file except in compliance
|
* "License"); you may not use this file except in compliance
|
||||||
* with the License. You may obtain a copy of the License at
|
* with the License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing,
|
* Unless required by applicable law or agreed to in writing,
|
||||||
* software distributed under the License is distributed on an
|
* software distributed under the License is distributed on an
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
* KIND, either express or implied. See the License for the
|
* KIND, either express or implied. See the License for the
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.olingo.commons.core.edm.provider;
|
package org.apache.olingo.commons.core.edm.provider;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.olingo.commons.api.edm.Edm;
|
import org.apache.olingo.commons.api.edm.Edm;
|
||||||
import org.apache.olingo.commons.api.edm.EdmAnnotatable;
|
import org.apache.olingo.commons.api.edm.EdmAnnotatable;
|
||||||
import org.apache.olingo.commons.api.edm.EdmAnnotation;
|
import org.apache.olingo.commons.api.edm.EdmAnnotation;
|
||||||
|
@ -28,16 +25,16 @@ import org.apache.olingo.commons.api.edm.EdmTerm;
|
||||||
import org.apache.olingo.commons.api.edm.provider.Annotatable;
|
import org.apache.olingo.commons.api.edm.provider.Annotatable;
|
||||||
import org.apache.olingo.commons.api.edm.provider.Annotation;
|
import org.apache.olingo.commons.api.edm.provider.Annotation;
|
||||||
|
|
||||||
public class EdmAnnotationHelperImpl implements EdmAnnotatable {
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
private final Edm edm;
|
public abstract class AbstractEdmAnnotatable extends AbstractEdmBase implements EdmAnnotatable {
|
||||||
|
|
||||||
private final Annotatable annotatable;
|
private final Annotatable annotatable;
|
||||||
|
|
||||||
private List<EdmAnnotation> annotations;
|
private List<EdmAnnotation> annotations;
|
||||||
|
|
||||||
public EdmAnnotationHelperImpl(final Edm edm, final Annotatable annotatable) {
|
public AbstractEdmAnnotatable(final Edm edm, final Annotatable annotatable) {
|
||||||
this.edm = edm;
|
super(edm);
|
||||||
this.annotatable = annotatable;
|
this.annotatable = annotatable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,11 +54,12 @@ public class EdmAnnotationHelperImpl implements EdmAnnotatable {
|
||||||
public List<EdmAnnotation> getAnnotations() {
|
public List<EdmAnnotation> getAnnotations() {
|
||||||
if (annotations == null) {
|
if (annotations == null) {
|
||||||
annotations = new ArrayList<EdmAnnotation>();
|
annotations = new ArrayList<EdmAnnotation>();
|
||||||
for (Annotation annotation : annotatable.getAnnotations()) {
|
if(annotatable != null) {
|
||||||
annotations.add(new EdmAnnotationImpl(edm, annotation));
|
for (Annotation annotation : annotatable.getAnnotations()) {
|
||||||
|
annotations.add(new EdmAnnotationImpl(edm, annotation));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return annotations;
|
return annotations;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -19,11 +19,13 @@
|
||||||
package org.apache.olingo.commons.core.edm.provider;
|
package org.apache.olingo.commons.core.edm.provider;
|
||||||
|
|
||||||
import org.apache.olingo.commons.api.edm.Edm;
|
import org.apache.olingo.commons.api.edm.Edm;
|
||||||
import org.apache.olingo.commons.api.edm.EdmElement;
|
import org.apache.olingo.commons.api.edm.EdmAnnotatable;
|
||||||
|
|
||||||
public abstract class EdmElementImpl extends EdmNamedImpl implements EdmElement {
|
public abstract class AbstractEdmBase implements EdmAnnotatable {
|
||||||
|
|
||||||
public EdmElementImpl(final Edm edm, final String name) {
|
protected final Edm edm;
|
||||||
super(edm, name);
|
|
||||||
|
public AbstractEdmBase(final Edm edm) {
|
||||||
|
this.edm = edm;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -23,31 +23,27 @@ import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.olingo.commons.api.edm.Edm;
|
import org.apache.olingo.commons.api.edm.Edm;
|
||||||
import org.apache.olingo.commons.api.edm.EdmAnnotation;
|
|
||||||
import org.apache.olingo.commons.api.edm.EdmBindingTarget;
|
import org.apache.olingo.commons.api.edm.EdmBindingTarget;
|
||||||
import org.apache.olingo.commons.api.edm.EdmEntityContainer;
|
import org.apache.olingo.commons.api.edm.EdmEntityContainer;
|
||||||
import org.apache.olingo.commons.api.edm.EdmEntityType;
|
import org.apache.olingo.commons.api.edm.EdmEntityType;
|
||||||
import org.apache.olingo.commons.api.edm.EdmException;
|
import org.apache.olingo.commons.api.edm.EdmException;
|
||||||
import org.apache.olingo.commons.api.edm.EdmNavigationPropertyBinding;
|
import org.apache.olingo.commons.api.edm.EdmNavigationPropertyBinding;
|
||||||
import org.apache.olingo.commons.api.edm.EdmTerm;
|
|
||||||
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
||||||
import org.apache.olingo.commons.api.edm.Target;
|
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.BindingTarget;
|
||||||
import org.apache.olingo.commons.api.edm.provider.NavigationPropertyBinding;
|
import org.apache.olingo.commons.api.edm.provider.NavigationPropertyBinding;
|
||||||
|
|
||||||
public abstract class EdmBindingTargetImpl extends EdmNamedImpl implements EdmBindingTarget {
|
public abstract class AbstractEdmBindingTarget extends AbstractEdmNamed implements EdmBindingTarget {
|
||||||
|
|
||||||
private final BindingTarget target;
|
private final BindingTarget target;
|
||||||
private final EdmAnnotationHelperImpl helper;
|
|
||||||
private final EdmEntityContainer container;
|
private final EdmEntityContainer container;
|
||||||
|
|
||||||
private List<EdmNavigationPropertyBinding> navigationPropertyBindings;
|
private List<EdmNavigationPropertyBinding> navigationPropertyBindings;
|
||||||
|
|
||||||
public EdmBindingTargetImpl(final Edm edm, final EdmEntityContainer container, final BindingTarget target) {
|
public AbstractEdmBindingTarget(final Edm edm, final EdmEntityContainer container, final BindingTarget target) {
|
||||||
super(edm, target.getName());
|
super(edm, target.getName(), target);
|
||||||
this.container = container;
|
this.container = container;
|
||||||
this.target = target;
|
this.target = target;
|
||||||
this.helper = new EdmAnnotationHelperImpl(edm, target);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -128,14 +124,4 @@ public abstract class EdmBindingTargetImpl extends EdmNamedImpl implements EdmBi
|
||||||
|
|
||||||
return bindingTarget;
|
return bindingTarget;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public EdmAnnotation getAnnotation(final EdmTerm term) {
|
|
||||||
return helper.getAnnotation(term);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<EdmAnnotation> getAnnotations() {
|
|
||||||
return helper.getAnnotations();
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -20,15 +20,14 @@ package org.apache.olingo.commons.core.edm.provider;
|
||||||
|
|
||||||
import org.apache.olingo.commons.api.edm.Edm;
|
import org.apache.olingo.commons.api.edm.Edm;
|
||||||
import org.apache.olingo.commons.api.edm.EdmNamed;
|
import org.apache.olingo.commons.api.edm.EdmNamed;
|
||||||
|
import org.apache.olingo.commons.api.edm.provider.Annotatable;
|
||||||
|
|
||||||
public abstract class EdmNamedImpl implements EdmNamed {
|
public abstract class AbstractEdmNamed extends AbstractEdmAnnotatable implements EdmNamed {
|
||||||
|
|
||||||
protected final Edm edm;
|
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
||||||
public EdmNamedImpl(final Edm edm, final String name) {
|
public AbstractEdmNamed(final Edm edm, final String name, final Annotatable annotatable) {
|
||||||
this.edm = edm;
|
super(edm, annotatable);
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,30 +24,27 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.olingo.commons.api.edm.Edm;
|
import org.apache.olingo.commons.api.edm.Edm;
|
||||||
import org.apache.olingo.commons.api.edm.EdmAnnotation;
|
|
||||||
import org.apache.olingo.commons.api.edm.EdmBindingTarget;
|
import org.apache.olingo.commons.api.edm.EdmBindingTarget;
|
||||||
import org.apache.olingo.commons.api.edm.EdmEntitySet;
|
import org.apache.olingo.commons.api.edm.EdmEntitySet;
|
||||||
import org.apache.olingo.commons.api.edm.EdmException;
|
import org.apache.olingo.commons.api.edm.EdmException;
|
||||||
import org.apache.olingo.commons.api.edm.EdmOperation;
|
import org.apache.olingo.commons.api.edm.EdmOperation;
|
||||||
import org.apache.olingo.commons.api.edm.EdmParameter;
|
import org.apache.olingo.commons.api.edm.EdmParameter;
|
||||||
import org.apache.olingo.commons.api.edm.EdmReturnType;
|
import org.apache.olingo.commons.api.edm.EdmReturnType;
|
||||||
import org.apache.olingo.commons.api.edm.EdmTerm;
|
|
||||||
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
||||||
import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
|
import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
|
||||||
import org.apache.olingo.commons.api.edm.provider.Operation;
|
import org.apache.olingo.commons.api.edm.provider.Operation;
|
||||||
import org.apache.olingo.commons.api.edm.provider.Parameter;
|
import org.apache.olingo.commons.api.edm.provider.Parameter;
|
||||||
|
|
||||||
public abstract class EdmOperationImpl extends EdmTypeImpl implements EdmOperation {
|
public abstract class AbstractEdmOperation extends EdmTypeImpl implements EdmOperation {
|
||||||
|
|
||||||
protected final Operation operation;
|
protected final Operation operation;
|
||||||
protected final EdmAnnotationHelperImpl helper;
|
|
||||||
private final Map<String, EdmParameter> parameters = new LinkedHashMap<String, EdmParameter>();
|
private final Map<String, EdmParameter> parameters = new LinkedHashMap<String, EdmParameter>();
|
||||||
private String entitySetPath;
|
private String entitySetPath;
|
||||||
private boolean isBound;
|
private boolean isBound;
|
||||||
private EdmReturnType returnType;
|
private EdmReturnType returnType;
|
||||||
private List<String> parameterNames;
|
private List<String> parameterNames;
|
||||||
|
|
||||||
protected static <T extends EdmOperationImpl> T getInstance(final T instance) {
|
protected static <T extends AbstractEdmOperation> T getInstance(final T instance) {
|
||||||
final List<Parameter> providerParameters = instance.operation.getParameters();
|
final List<Parameter> providerParameters = instance.operation.getParameters();
|
||||||
if (providerParameters != null) {
|
if (providerParameters != null) {
|
||||||
final List<EdmParameter> _parameters = new ArrayList<EdmParameter>(providerParameters.size());
|
final List<EdmParameter> _parameters = new ArrayList<EdmParameter>(providerParameters.size());
|
||||||
|
@ -71,12 +68,11 @@ public abstract class EdmOperationImpl extends EdmTypeImpl implements EdmOperati
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected EdmOperationImpl(final Edm edm, final FullQualifiedName name, final Operation operation,
|
protected AbstractEdmOperation(final Edm edm, final FullQualifiedName name, final Operation operation,
|
||||||
final EdmTypeKind kind) {
|
final EdmTypeKind kind) {
|
||||||
|
|
||||||
super(edm, name, kind);
|
super(edm, name, kind, operation);
|
||||||
this.operation = operation;
|
this.operation = operation;
|
||||||
this.helper = new EdmAnnotationHelperImpl(edm, operation);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setParameters(final List<EdmParameter> _parameters) {
|
protected void setParameters(final List<EdmParameter> _parameters) {
|
||||||
|
@ -159,16 +155,6 @@ public abstract class EdmOperationImpl extends EdmTypeImpl implements EdmOperati
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public EdmAnnotation getAnnotation(final EdmTerm term) {
|
|
||||||
return helper.getAnnotation(term);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<EdmAnnotation> getAnnotations() {
|
|
||||||
return helper.getAnnotations();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEntitySetPath(){
|
public String getEntitySetPath(){
|
||||||
return operation.getEntitySetPath();
|
return operation.getEntitySetPath();
|
|
@ -18,31 +18,25 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.olingo.commons.core.edm.provider;
|
package org.apache.olingo.commons.core.edm.provider;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.olingo.commons.api.edm.Edm;
|
import org.apache.olingo.commons.api.edm.Edm;
|
||||||
import org.apache.olingo.commons.api.edm.EdmAnnotation;
|
|
||||||
import org.apache.olingo.commons.api.edm.EdmEntityContainer;
|
import org.apache.olingo.commons.api.edm.EdmEntityContainer;
|
||||||
import org.apache.olingo.commons.api.edm.EdmEntitySet;
|
import org.apache.olingo.commons.api.edm.EdmEntitySet;
|
||||||
import org.apache.olingo.commons.api.edm.EdmException;
|
import org.apache.olingo.commons.api.edm.EdmException;
|
||||||
import org.apache.olingo.commons.api.edm.EdmOperationImport;
|
import org.apache.olingo.commons.api.edm.EdmOperationImport;
|
||||||
import org.apache.olingo.commons.api.edm.EdmTerm;
|
|
||||||
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
||||||
import org.apache.olingo.commons.api.edm.Target;
|
import org.apache.olingo.commons.api.edm.Target;
|
||||||
import org.apache.olingo.commons.api.edm.provider.OperationImport;
|
import org.apache.olingo.commons.api.edm.provider.OperationImport;
|
||||||
|
|
||||||
public abstract class EdmOperationImportImpl extends EdmNamedImpl implements EdmOperationImport {
|
public abstract class AbstractEdmOperationImport extends AbstractEdmNamed implements EdmOperationImport {
|
||||||
|
|
||||||
protected final EdmEntityContainer container;
|
protected final EdmEntityContainer container;
|
||||||
private final Target entitySet;
|
private final Target entitySet;
|
||||||
private EdmEntitySet returnedEntitySet;
|
private EdmEntitySet returnedEntitySet;
|
||||||
private final EdmAnnotationHelperImpl helper;
|
|
||||||
|
|
||||||
public EdmOperationImportImpl(final Edm edm, final EdmEntityContainer container,
|
public AbstractEdmOperationImport(final Edm edm, final EdmEntityContainer container,
|
||||||
final OperationImport operationImport) {
|
final OperationImport operationImport) {
|
||||||
super(edm, operationImport.getName());
|
super(edm, operationImport.getName(), operationImport);
|
||||||
this.container = container;
|
this.container = container;
|
||||||
this.helper = new EdmAnnotationHelperImpl(edm, operationImport);
|
|
||||||
this.entitySet = new Target.Builder(operationImport.getEntitySet(), container).build();
|
this.entitySet = new Target.Builder(operationImport.getEntitySet(), container).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,14 +74,4 @@ public abstract class EdmOperationImportImpl extends EdmNamedImpl implements Edm
|
||||||
public String getAnnotationsTargetPath() {
|
public String getAnnotationsTargetPath() {
|
||||||
return getName();
|
return getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public EdmAnnotation getAnnotation(final EdmTerm term) {
|
|
||||||
return helper.getAnnotation(term);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<EdmAnnotation> getAnnotations() {
|
|
||||||
return helper.getAnnotations();
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -36,7 +36,7 @@ import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public abstract class EdmStructuredTypeImpl extends EdmTypeImpl implements EdmStructuredType {
|
public abstract class AbstractEdmStructuredType extends EdmTypeImpl implements EdmStructuredType {
|
||||||
|
|
||||||
protected EdmStructuredType baseType;
|
protected EdmStructuredType baseType;
|
||||||
protected FullQualifiedName baseTypeName;
|
protected FullQualifiedName baseTypeName;
|
||||||
|
@ -47,13 +47,13 @@ public abstract class EdmStructuredTypeImpl extends EdmTypeImpl implements EdmSt
|
||||||
private Map<String, EdmNavigationProperty> navigationProperties;
|
private Map<String, EdmNavigationProperty> navigationProperties;
|
||||||
private final StructuralType structuredType;
|
private final StructuralType structuredType;
|
||||||
|
|
||||||
public EdmStructuredTypeImpl(
|
public AbstractEdmStructuredType(
|
||||||
final Edm edm,
|
final Edm edm,
|
||||||
final FullQualifiedName typeName,
|
final FullQualifiedName typeName,
|
||||||
final EdmTypeKind kind,
|
final EdmTypeKind kind,
|
||||||
final StructuralType structuredType) {
|
final StructuralType structuredType) {
|
||||||
|
|
||||||
super(edm, typeName, kind);
|
super(edm, typeName, kind, structuredType);
|
||||||
this.baseTypeName = structuredType.getBaseTypeFQN();
|
this.baseTypeName = structuredType.getBaseTypeFQN();
|
||||||
this.structuredType = structuredType;
|
this.structuredType = structuredType;
|
||||||
}
|
}
|
|
@ -24,10 +24,10 @@ import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
||||||
import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
|
import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
|
||||||
import org.apache.olingo.commons.api.edm.provider.Action;
|
import org.apache.olingo.commons.api.edm.provider.Action;
|
||||||
|
|
||||||
public class EdmActionImpl extends EdmOperationImpl implements EdmAction {
|
public class EdmActionImpl extends AbstractEdmOperation implements EdmAction {
|
||||||
|
|
||||||
public static EdmActionImpl getInstance(final Edm edm, final FullQualifiedName name, final Action action) {
|
public static EdmActionImpl getInstance(final Edm edm, final FullQualifiedName name, final Action action) {
|
||||||
return EdmOperationImpl.getInstance(new EdmActionImpl(edm, name, action));
|
return AbstractEdmOperation.getInstance(new EdmActionImpl(edm, name, action));
|
||||||
}
|
}
|
||||||
|
|
||||||
private EdmActionImpl(final Edm edm, final FullQualifiedName name, final Action action) {
|
private EdmActionImpl(final Edm edm, final FullQualifiedName name, final Action action) {
|
||||||
|
|
|
@ -24,7 +24,7 @@ import org.apache.olingo.commons.api.edm.EdmActionImport;
|
||||||
import org.apache.olingo.commons.api.edm.EdmEntityContainer;
|
import org.apache.olingo.commons.api.edm.EdmEntityContainer;
|
||||||
import org.apache.olingo.commons.api.edm.provider.ActionImport;
|
import org.apache.olingo.commons.api.edm.provider.ActionImport;
|
||||||
|
|
||||||
public class EdmActionImportImpl extends EdmOperationImportImpl implements EdmActionImport {
|
public class EdmActionImportImpl extends AbstractEdmOperationImport implements EdmActionImport {
|
||||||
|
|
||||||
private final ActionImport actionImport;
|
private final ActionImport actionImport;
|
||||||
|
|
||||||
|
|
|
@ -60,18 +60,15 @@ import org.apache.olingo.commons.core.edm.annotation.EdmPropertyValueImpl;
|
||||||
import org.apache.olingo.commons.core.edm.annotation.EdmRecordImpl;
|
import org.apache.olingo.commons.core.edm.annotation.EdmRecordImpl;
|
||||||
import org.apache.olingo.commons.core.edm.annotation.EdmUrlRefImpl;
|
import org.apache.olingo.commons.core.edm.annotation.EdmUrlRefImpl;
|
||||||
|
|
||||||
public class EdmAnnotationImpl implements EdmAnnotation {
|
public class EdmAnnotationImpl extends AbstractEdmAnnotatable implements EdmAnnotation {
|
||||||
|
|
||||||
private final Edm edm;
|
|
||||||
private final Annotation annotation;
|
private final Annotation annotation;
|
||||||
private final EdmAnnotationHelperImpl helper;
|
|
||||||
private EdmTerm term;
|
private EdmTerm term;
|
||||||
private EdmAnnotationExpression expression;
|
private EdmAnnotationExpression expression;
|
||||||
|
|
||||||
public EdmAnnotationImpl(final Edm edm, final Annotation annotation) {
|
public EdmAnnotationImpl(final Edm edm, final Annotation annotation) {
|
||||||
this.edm = edm;
|
super(edm, annotation);
|
||||||
this.annotation = annotation;
|
this.annotation = annotation;
|
||||||
this.helper = new EdmAnnotationHelperImpl(edm, annotation);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -225,15 +222,4 @@ public class EdmAnnotationImpl implements EdmAnnotation {
|
||||||
}
|
}
|
||||||
return expression;
|
return expression;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public EdmAnnotation getAnnotation(final EdmTerm term) {
|
|
||||||
return helper.getAnnotation(term);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<EdmAnnotation> getAnnotations() {
|
|
||||||
return helper.getAnnotations();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,21 +18,15 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.olingo.commons.core.edm.provider;
|
package org.apache.olingo.commons.core.edm.provider;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.olingo.commons.api.edm.Edm;
|
import org.apache.olingo.commons.api.edm.Edm;
|
||||||
import org.apache.olingo.commons.api.edm.EdmAnnotation;
|
|
||||||
import org.apache.olingo.commons.api.edm.EdmComplexType;
|
import org.apache.olingo.commons.api.edm.EdmComplexType;
|
||||||
import org.apache.olingo.commons.api.edm.EdmException;
|
import org.apache.olingo.commons.api.edm.EdmException;
|
||||||
import org.apache.olingo.commons.api.edm.EdmStructuredType;
|
import org.apache.olingo.commons.api.edm.EdmStructuredType;
|
||||||
import org.apache.olingo.commons.api.edm.EdmTerm;
|
|
||||||
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
||||||
import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
|
import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
|
||||||
import org.apache.olingo.commons.api.edm.provider.ComplexType;
|
import org.apache.olingo.commons.api.edm.provider.ComplexType;
|
||||||
|
|
||||||
public class EdmComplexTypeImpl extends EdmStructuredTypeImpl implements EdmComplexType {
|
public class EdmComplexTypeImpl extends AbstractEdmStructuredType implements EdmComplexType {
|
||||||
|
|
||||||
private EdmAnnotationHelperImpl annotationHelper;
|
|
||||||
|
|
||||||
public static EdmComplexTypeImpl getInstance(
|
public static EdmComplexTypeImpl getInstance(
|
||||||
final Edm edm, final FullQualifiedName name, final ComplexType complexType) {
|
final Edm edm, final FullQualifiedName name, final ComplexType complexType) {
|
||||||
|
@ -41,17 +35,6 @@ public class EdmComplexTypeImpl extends EdmStructuredTypeImpl implements EdmComp
|
||||||
|
|
||||||
private EdmComplexTypeImpl(final Edm edm, final FullQualifiedName name, final ComplexType complexType) {
|
private EdmComplexTypeImpl(final Edm edm, final FullQualifiedName name, final ComplexType complexType) {
|
||||||
super(edm, name, EdmTypeKind.COMPLEX, complexType);
|
super(edm, name, EdmTypeKind.COMPLEX, complexType);
|
||||||
this.annotationHelper = new EdmAnnotationHelperImpl(edm, complexType);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EdmAnnotation getAnnotation(final EdmTerm term) {
|
|
||||||
return annotationHelper == null ? null : annotationHelper.getAnnotation(term);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<EdmAnnotation> getAnnotations() {
|
|
||||||
return annotationHelper == null ? null : annotationHelper.getAnnotations();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
package org.apache.olingo.commons.core.edm.provider;
|
package org.apache.olingo.commons.core.edm.provider;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -27,13 +26,11 @@ import java.util.Map;
|
||||||
import org.apache.olingo.commons.api.ODataException;
|
import org.apache.olingo.commons.api.ODataException;
|
||||||
import org.apache.olingo.commons.api.edm.Edm;
|
import org.apache.olingo.commons.api.edm.Edm;
|
||||||
import org.apache.olingo.commons.api.edm.EdmActionImport;
|
import org.apache.olingo.commons.api.edm.EdmActionImport;
|
||||||
import org.apache.olingo.commons.api.edm.EdmAnnotation;
|
|
||||||
import org.apache.olingo.commons.api.edm.EdmEntityContainer;
|
import org.apache.olingo.commons.api.edm.EdmEntityContainer;
|
||||||
import org.apache.olingo.commons.api.edm.EdmEntitySet;
|
import org.apache.olingo.commons.api.edm.EdmEntitySet;
|
||||||
import org.apache.olingo.commons.api.edm.EdmException;
|
import org.apache.olingo.commons.api.edm.EdmException;
|
||||||
import org.apache.olingo.commons.api.edm.EdmFunctionImport;
|
import org.apache.olingo.commons.api.edm.EdmFunctionImport;
|
||||||
import org.apache.olingo.commons.api.edm.EdmSingleton;
|
import org.apache.olingo.commons.api.edm.EdmSingleton;
|
||||||
import org.apache.olingo.commons.api.edm.EdmTerm;
|
|
||||||
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
||||||
import org.apache.olingo.commons.api.edm.provider.ActionImport;
|
import org.apache.olingo.commons.api.edm.provider.ActionImport;
|
||||||
import org.apache.olingo.commons.api.edm.provider.EdmProvider;
|
import org.apache.olingo.commons.api.edm.provider.EdmProvider;
|
||||||
|
@ -43,11 +40,10 @@ import org.apache.olingo.commons.api.edm.provider.EntitySet;
|
||||||
import org.apache.olingo.commons.api.edm.provider.FunctionImport;
|
import org.apache.olingo.commons.api.edm.provider.FunctionImport;
|
||||||
import org.apache.olingo.commons.api.edm.provider.Singleton;
|
import org.apache.olingo.commons.api.edm.provider.Singleton;
|
||||||
|
|
||||||
public class EdmEntityContainerImpl extends EdmNamedImpl implements EdmEntityContainer {
|
public class EdmEntityContainerImpl extends AbstractEdmNamed implements EdmEntityContainer {
|
||||||
|
|
||||||
private final EdmProvider provider;
|
private final EdmProvider provider;
|
||||||
private EntityContainer container;
|
private EntityContainer container;
|
||||||
private EdmAnnotationHelperImpl helper;
|
|
||||||
|
|
||||||
protected final FullQualifiedName entityContainerName;
|
protected final FullQualifiedName entityContainerName;
|
||||||
private final FullQualifiedName parentContainerName;
|
private final FullQualifiedName parentContainerName;
|
||||||
|
@ -66,7 +62,7 @@ public class EdmEntityContainerImpl extends EdmNamedImpl implements EdmEntityCon
|
||||||
|
|
||||||
public EdmEntityContainerImpl(final Edm edm, final EdmProvider provider,
|
public EdmEntityContainerImpl(final Edm edm, final EdmProvider provider,
|
||||||
final EntityContainerInfo entityContainerInfo) {
|
final EntityContainerInfo entityContainerInfo) {
|
||||||
super(edm, entityContainerInfo.getContainerName().getName());
|
super(edm, entityContainerInfo.getContainerName().getName(), null);
|
||||||
this.provider = provider;
|
this.provider = provider;
|
||||||
this.entityContainerName = entityContainerInfo.getContainerName();
|
this.entityContainerName = entityContainerInfo.getContainerName();
|
||||||
this.parentContainerName = entityContainerInfo.getExtendsContainer();
|
this.parentContainerName = entityContainerInfo.getExtendsContainer();
|
||||||
|
@ -74,12 +70,11 @@ public class EdmEntityContainerImpl extends EdmNamedImpl implements EdmEntityCon
|
||||||
|
|
||||||
public EdmEntityContainerImpl(final Edm edm, final EdmProvider provider, final FullQualifiedName containerFQN,
|
public EdmEntityContainerImpl(final Edm edm, final EdmProvider provider, final FullQualifiedName containerFQN,
|
||||||
final EntityContainer entityContainer) {
|
final EntityContainer entityContainer) {
|
||||||
super(edm, containerFQN.getName());
|
super(edm, containerFQN.getName(), entityContainer);
|
||||||
this.provider = provider;
|
this.provider = provider;
|
||||||
container = entityContainer;
|
container = entityContainer;
|
||||||
this.entityContainerName = containerFQN;
|
this.entityContainerName = containerFQN;
|
||||||
this.parentContainerName = entityContainer.getExtendsContainerFQN();
|
this.parentContainerName = entityContainer.getExtendsContainerFQN();
|
||||||
this.helper = new EdmAnnotationHelperImpl(edm, entityContainer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -326,14 +321,4 @@ public class EdmEntityContainerImpl extends EdmNamedImpl implements EdmEntityCon
|
||||||
public TargetType getAnnotationsTargetType() {
|
public TargetType getAnnotationsTargetType() {
|
||||||
return TargetType.EntityContainer;
|
return TargetType.EntityContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public EdmAnnotation getAnnotation(final EdmTerm term) {
|
|
||||||
return helper == null ? null : helper.getAnnotation(term);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<EdmAnnotation> getAnnotations() {
|
|
||||||
return helper == null ? Collections.<EdmAnnotation> emptyList() : helper.getAnnotations();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ import org.apache.olingo.commons.api.edm.EdmEntityContainer;
|
||||||
import org.apache.olingo.commons.api.edm.EdmEntitySet;
|
import org.apache.olingo.commons.api.edm.EdmEntitySet;
|
||||||
import org.apache.olingo.commons.api.edm.provider.EntitySet;
|
import org.apache.olingo.commons.api.edm.provider.EntitySet;
|
||||||
|
|
||||||
public class EdmEntitySetImpl extends EdmBindingTargetImpl implements EdmEntitySet {
|
public class EdmEntitySetImpl extends AbstractEdmBindingTarget implements EdmEntitySet {
|
||||||
|
|
||||||
private EntitySet entitySet;
|
private EntitySet entitySet;
|
||||||
|
|
||||||
|
|
|
@ -24,22 +24,19 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.olingo.commons.api.edm.Edm;
|
import org.apache.olingo.commons.api.edm.Edm;
|
||||||
import org.apache.olingo.commons.api.edm.EdmAnnotation;
|
|
||||||
import org.apache.olingo.commons.api.edm.EdmEntityType;
|
import org.apache.olingo.commons.api.edm.EdmEntityType;
|
||||||
import org.apache.olingo.commons.api.edm.EdmException;
|
import org.apache.olingo.commons.api.edm.EdmException;
|
||||||
import org.apache.olingo.commons.api.edm.EdmKeyPropertyRef;
|
import org.apache.olingo.commons.api.edm.EdmKeyPropertyRef;
|
||||||
import org.apache.olingo.commons.api.edm.EdmStructuredType;
|
import org.apache.olingo.commons.api.edm.EdmStructuredType;
|
||||||
import org.apache.olingo.commons.api.edm.EdmTerm;
|
|
||||||
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
||||||
import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
|
import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
|
||||||
import org.apache.olingo.commons.api.edm.provider.EntityType;
|
import org.apache.olingo.commons.api.edm.provider.EntityType;
|
||||||
import org.apache.olingo.commons.api.edm.provider.PropertyRef;
|
import org.apache.olingo.commons.api.edm.provider.PropertyRef;
|
||||||
|
|
||||||
public class EdmEntityTypeImpl extends EdmStructuredTypeImpl implements EdmEntityType {
|
public class EdmEntityTypeImpl extends AbstractEdmStructuredType implements EdmEntityType {
|
||||||
|
|
||||||
private EntityType entityType;
|
private EntityType entityType;
|
||||||
private boolean baseTypeChecked = false;
|
private boolean baseTypeChecked = false;
|
||||||
private EdmAnnotationHelperImpl annotationHelper;
|
|
||||||
private final boolean hasStream;
|
private final boolean hasStream;
|
||||||
protected EdmEntityType entityBaseType;
|
protected EdmEntityType entityBaseType;
|
||||||
private final List<String> keyPredicateNames = new ArrayList<String>();
|
private final List<String> keyPredicateNames = new ArrayList<String>();
|
||||||
|
@ -56,7 +53,6 @@ public class EdmEntityTypeImpl extends EdmStructuredTypeImpl implements EdmEntit
|
||||||
super(edm, name, EdmTypeKind.ENTITY, entityType);
|
super(edm, name, EdmTypeKind.ENTITY, entityType);
|
||||||
this.entityType = entityType;
|
this.entityType = entityType;
|
||||||
hasStream = entityType.hasStream();
|
hasStream = entityType.hasStream();
|
||||||
this.annotationHelper = new EdmAnnotationHelperImpl(edm, entityType);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -151,14 +147,4 @@ public class EdmEntityTypeImpl extends EdmStructuredTypeImpl implements EdmEntit
|
||||||
public TargetType getAnnotationsTargetType() {
|
public TargetType getAnnotationsTargetType() {
|
||||||
return TargetType.EntityType;
|
return TargetType.EntityType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public EdmAnnotation getAnnotation(final EdmTerm term) {
|
|
||||||
return annotationHelper.getAnnotation(term);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<EdmAnnotation> getAnnotations() {
|
|
||||||
return annotationHelper.getAnnotations();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,13 +42,13 @@ import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
|
||||||
public class EdmEnumTypeImpl extends EdmTypeImpl implements EdmEnumType {
|
public class EdmEnumTypeImpl extends EdmTypeImpl implements EdmEnumType {
|
||||||
|
|
||||||
private static final Set<EdmPrimitiveTypeKind> VALID_UNDERLYING_TYPES = new HashSet<EdmPrimitiveTypeKind>();
|
private static final Set<EdmPrimitiveTypeKind> VALID_UNDERLYING_TYPES = new HashSet<EdmPrimitiveTypeKind>();
|
||||||
{
|
static {
|
||||||
VALID_UNDERLYING_TYPES.add(EdmPrimitiveTypeKind.Byte);
|
VALID_UNDERLYING_TYPES.add(EdmPrimitiveTypeKind.Byte);
|
||||||
VALID_UNDERLYING_TYPES.add(EdmPrimitiveTypeKind.SByte);
|
VALID_UNDERLYING_TYPES.add(EdmPrimitiveTypeKind.SByte);
|
||||||
VALID_UNDERLYING_TYPES.add(EdmPrimitiveTypeKind.Int16);
|
VALID_UNDERLYING_TYPES.add(EdmPrimitiveTypeKind.Int16);
|
||||||
VALID_UNDERLYING_TYPES.add(EdmPrimitiveTypeKind.Int32);
|
VALID_UNDERLYING_TYPES.add(EdmPrimitiveTypeKind.Int32);
|
||||||
VALID_UNDERLYING_TYPES.add(EdmPrimitiveTypeKind.Int64);
|
VALID_UNDERLYING_TYPES.add(EdmPrimitiveTypeKind.Int64);
|
||||||
};
|
}
|
||||||
|
|
||||||
private final EdmPrimitiveType underlyingType;
|
private final EdmPrimitiveType underlyingType;
|
||||||
private final EnumType enumType;
|
private final EnumType enumType;
|
||||||
|
@ -58,7 +58,7 @@ public class EdmEnumTypeImpl extends EdmTypeImpl implements EdmEnumType {
|
||||||
private LinkedHashMap<String, EdmMember> membersMap;
|
private LinkedHashMap<String, EdmMember> membersMap;
|
||||||
|
|
||||||
public EdmEnumTypeImpl(final Edm edm, final FullQualifiedName enumName, final EnumType enumType) {
|
public EdmEnumTypeImpl(final Edm edm, final FullQualifiedName enumName, final EnumType enumType) {
|
||||||
super(edm, enumName, EdmTypeKind.ENUM);
|
super(edm, enumName, EdmTypeKind.ENUM, enumType);
|
||||||
|
|
||||||
if (enumType.getUnderlyingType() == null) {
|
if (enumType.getUnderlyingType() == null) {
|
||||||
underlyingType = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int32);
|
underlyingType = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int32);
|
||||||
|
|
|
@ -26,12 +26,12 @@ import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
||||||
import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
|
import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
|
||||||
import org.apache.olingo.commons.api.edm.provider.Function;
|
import org.apache.olingo.commons.api.edm.provider.Function;
|
||||||
|
|
||||||
public class EdmFunctionImpl extends EdmOperationImpl implements EdmFunction {
|
public class EdmFunctionImpl extends AbstractEdmOperation implements EdmFunction {
|
||||||
|
|
||||||
private final Function function;
|
private final Function function;
|
||||||
|
|
||||||
public static EdmFunctionImpl getInstance(final Edm edm, final FullQualifiedName name, final Function function) {
|
public static EdmFunctionImpl getInstance(final Edm edm, final FullQualifiedName name, final Function function) {
|
||||||
return EdmOperationImpl.getInstance(new EdmFunctionImpl(edm, name, function));
|
return AbstractEdmOperation.getInstance(new EdmFunctionImpl(edm, name, function));
|
||||||
}
|
}
|
||||||
|
|
||||||
private EdmFunctionImpl(final Edm edm, final FullQualifiedName name, final Function function) {
|
private EdmFunctionImpl(final Edm edm, final FullQualifiedName name, final Function function) {
|
||||||
|
|
|
@ -27,7 +27,7 @@ import org.apache.olingo.commons.api.edm.EdmFunctionImport;
|
||||||
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
||||||
import org.apache.olingo.commons.api.edm.provider.FunctionImport;
|
import org.apache.olingo.commons.api.edm.provider.FunctionImport;
|
||||||
|
|
||||||
public class EdmFunctionImportImpl extends EdmOperationImportImpl implements EdmFunctionImport {
|
public class EdmFunctionImportImpl extends AbstractEdmOperationImport implements EdmFunctionImport {
|
||||||
|
|
||||||
private final FunctionImport functionImport;
|
private final FunctionImport functionImport;
|
||||||
|
|
||||||
|
|
|
@ -18,26 +18,20 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.olingo.commons.core.edm.provider;
|
package org.apache.olingo.commons.core.edm.provider;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.olingo.commons.api.edm.Edm;
|
import org.apache.olingo.commons.api.edm.Edm;
|
||||||
import org.apache.olingo.commons.api.edm.EdmAnnotation;
|
|
||||||
import org.apache.olingo.commons.api.edm.EdmMember;
|
import org.apache.olingo.commons.api.edm.EdmMember;
|
||||||
import org.apache.olingo.commons.api.edm.EdmTerm;
|
|
||||||
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
||||||
import org.apache.olingo.commons.api.edm.provider.EnumMember;
|
import org.apache.olingo.commons.api.edm.provider.EnumMember;
|
||||||
|
|
||||||
public class EdmMemberImpl extends EdmNamedImpl implements EdmMember {
|
public class EdmMemberImpl extends AbstractEdmNamed implements EdmMember {
|
||||||
|
|
||||||
private final EdmAnnotationHelperImpl helper;
|
|
||||||
private final FullQualifiedName enumFQN;
|
private final FullQualifiedName enumFQN;
|
||||||
private final EnumMember member;
|
private final EnumMember member;
|
||||||
|
|
||||||
public EdmMemberImpl(final Edm edm, final FullQualifiedName enumFQN, final EnumMember member) {
|
public EdmMemberImpl(final Edm edm, final FullQualifiedName enumFQN, final EnumMember member) {
|
||||||
super(edm, member.getName());
|
super(edm, member.getName(), member);
|
||||||
this.enumFQN = enumFQN;
|
this.enumFQN = enumFQN;
|
||||||
this.member = member;
|
this.member = member;
|
||||||
this.helper = new EdmAnnotationHelperImpl(edm, member);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -59,15 +53,4 @@ public class EdmMemberImpl extends EdmNamedImpl implements EdmMember {
|
||||||
public String getValue() {
|
public String getValue() {
|
||||||
return member.getValue();
|
return member.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public EdmAnnotation getAnnotation(final EdmTerm term) {
|
|
||||||
return helper.getAnnotation(term);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<EdmAnnotation> getAnnotations() {
|
|
||||||
return helper.getAnnotations();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,32 +22,29 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.olingo.commons.api.edm.Edm;
|
import org.apache.olingo.commons.api.edm.Edm;
|
||||||
import org.apache.olingo.commons.api.edm.EdmAnnotation;
|
import org.apache.olingo.commons.api.edm.EdmElement;
|
||||||
import org.apache.olingo.commons.api.edm.EdmEntityType;
|
import org.apache.olingo.commons.api.edm.EdmEntityType;
|
||||||
import org.apache.olingo.commons.api.edm.EdmException;
|
import org.apache.olingo.commons.api.edm.EdmException;
|
||||||
import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
|
import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
|
||||||
import org.apache.olingo.commons.api.edm.EdmReferentialConstraint;
|
import org.apache.olingo.commons.api.edm.EdmReferentialConstraint;
|
||||||
import org.apache.olingo.commons.api.edm.EdmStructuredType;
|
import org.apache.olingo.commons.api.edm.EdmStructuredType;
|
||||||
import org.apache.olingo.commons.api.edm.EdmTerm;
|
|
||||||
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
||||||
import org.apache.olingo.commons.api.edm.provider.NavigationProperty;
|
import org.apache.olingo.commons.api.edm.provider.NavigationProperty;
|
||||||
import org.apache.olingo.commons.api.edm.provider.ReferentialConstraint;
|
import org.apache.olingo.commons.api.edm.provider.ReferentialConstraint;
|
||||||
|
|
||||||
public class EdmNavigationPropertyImpl extends EdmElementImpl implements EdmNavigationProperty {
|
public class EdmNavigationPropertyImpl extends AbstractEdmNamed implements EdmElement, EdmNavigationProperty {
|
||||||
|
|
||||||
private final FullQualifiedName structuredTypeName;
|
private final FullQualifiedName structuredTypeName;
|
||||||
private final NavigationProperty navigationProperty;
|
private final NavigationProperty navigationProperty;
|
||||||
private final EdmAnnotationHelperImpl helper;
|
|
||||||
private List<EdmReferentialConstraint> referentialConstraints;
|
private List<EdmReferentialConstraint> referentialConstraints;
|
||||||
private EdmEntityType typeImpl;
|
private EdmEntityType typeImpl;
|
||||||
private EdmNavigationProperty partnerNavigationProperty;
|
private EdmNavigationProperty partnerNavigationProperty;
|
||||||
|
|
||||||
public EdmNavigationPropertyImpl(
|
public EdmNavigationPropertyImpl(
|
||||||
final Edm edm, final FullQualifiedName structuredTypeName, final NavigationProperty navigationProperty) {
|
final Edm edm, final FullQualifiedName structuredTypeName, final NavigationProperty navigationProperty) {
|
||||||
super(edm, navigationProperty.getName());
|
super(edm, navigationProperty.getName(), navigationProperty);
|
||||||
this.structuredTypeName = structuredTypeName;
|
this.structuredTypeName = structuredTypeName;
|
||||||
this.navigationProperty = navigationProperty;
|
this.navigationProperty = navigationProperty;
|
||||||
this.helper = new EdmAnnotationHelperImpl(edm, navigationProperty);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -139,14 +136,4 @@ public class EdmNavigationPropertyImpl extends EdmElementImpl implements EdmNavi
|
||||||
public FullQualifiedName getAnnotationsTargetFQN() {
|
public FullQualifiedName getAnnotationsTargetFQN() {
|
||||||
return structuredTypeName;
|
return structuredTypeName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public EdmAnnotation getAnnotation(final EdmTerm term) {
|
|
||||||
return helper.getAnnotation(term);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<EdmAnnotation> getAnnotations() {
|
|
||||||
return helper.getAnnotations();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,29 +18,24 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.olingo.commons.core.edm.provider;
|
package org.apache.olingo.commons.core.edm.provider;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.olingo.commons.api.edm.Edm;
|
import org.apache.olingo.commons.api.edm.Edm;
|
||||||
import org.apache.olingo.commons.api.edm.EdmAnnotation;
|
import org.apache.olingo.commons.api.edm.EdmElement;
|
||||||
import org.apache.olingo.commons.api.edm.EdmException;
|
import org.apache.olingo.commons.api.edm.EdmException;
|
||||||
import org.apache.olingo.commons.api.edm.EdmMapping;
|
import org.apache.olingo.commons.api.edm.EdmMapping;
|
||||||
import org.apache.olingo.commons.api.edm.EdmParameter;
|
import org.apache.olingo.commons.api.edm.EdmParameter;
|
||||||
import org.apache.olingo.commons.api.edm.EdmTerm;
|
|
||||||
import org.apache.olingo.commons.api.edm.EdmType;
|
import org.apache.olingo.commons.api.edm.EdmType;
|
||||||
import org.apache.olingo.commons.api.edm.geo.SRID;
|
import org.apache.olingo.commons.api.edm.geo.SRID;
|
||||||
import org.apache.olingo.commons.api.edm.provider.Parameter;
|
import org.apache.olingo.commons.api.edm.provider.Parameter;
|
||||||
|
|
||||||
public class EdmParameterImpl extends EdmElementImpl implements EdmParameter {
|
public class EdmParameterImpl extends AbstractEdmNamed implements EdmParameter, EdmElement {
|
||||||
|
|
||||||
private final Parameter parameter;
|
private final Parameter parameter;
|
||||||
private final EdmAnnotationHelperImpl helper;
|
|
||||||
private final EdmTypeInfo typeInfo;
|
private final EdmTypeInfo typeInfo;
|
||||||
private EdmType typeImpl;
|
private EdmType typeImpl;
|
||||||
|
|
||||||
public EdmParameterImpl(final Edm edm, final Parameter parameter) {
|
public EdmParameterImpl(final Edm edm, final Parameter parameter) {
|
||||||
super(edm, parameter.getName());
|
super(edm, parameter.getName(), parameter);
|
||||||
this.parameter = parameter;
|
this.parameter = parameter;
|
||||||
this.helper = new EdmAnnotationHelperImpl(edm, parameter);
|
|
||||||
this.typeInfo = new EdmTypeInfo.Builder().setEdm(edm).setTypeExpression(parameter.getType()).build();
|
this.typeInfo = new EdmTypeInfo.Builder().setEdm(edm).setTypeExpression(parameter.getType()).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,16 +74,6 @@ public class EdmParameterImpl extends EdmElementImpl implements EdmParameter {
|
||||||
return parameter.getSrid();
|
return parameter.getSrid();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public EdmAnnotation getAnnotation(final EdmTerm term) {
|
|
||||||
return helper.getAnnotation(term);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<EdmAnnotation> getAnnotations() {
|
|
||||||
return helper.getAnnotations();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EdmType getType() {
|
public EdmType getType() {
|
||||||
if (typeImpl == null) {
|
if (typeImpl == null) {
|
||||||
|
|
|
@ -18,34 +18,29 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.olingo.commons.core.edm.provider;
|
package org.apache.olingo.commons.core.edm.provider;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.olingo.commons.api.edm.Edm;
|
import org.apache.olingo.commons.api.edm.Edm;
|
||||||
import org.apache.olingo.commons.api.edm.EdmAnnotation;
|
import org.apache.olingo.commons.api.edm.EdmElement;
|
||||||
import org.apache.olingo.commons.api.edm.EdmException;
|
import org.apache.olingo.commons.api.edm.EdmException;
|
||||||
import org.apache.olingo.commons.api.edm.EdmMapping;
|
import org.apache.olingo.commons.api.edm.EdmMapping;
|
||||||
import org.apache.olingo.commons.api.edm.EdmProperty;
|
import org.apache.olingo.commons.api.edm.EdmProperty;
|
||||||
import org.apache.olingo.commons.api.edm.EdmTerm;
|
|
||||||
import org.apache.olingo.commons.api.edm.EdmType;
|
import org.apache.olingo.commons.api.edm.EdmType;
|
||||||
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
||||||
import org.apache.olingo.commons.api.edm.geo.SRID;
|
import org.apache.olingo.commons.api.edm.geo.SRID;
|
||||||
import org.apache.olingo.commons.api.edm.provider.Property;
|
import org.apache.olingo.commons.api.edm.provider.Property;
|
||||||
|
|
||||||
public class EdmPropertyImpl extends EdmElementImpl implements EdmProperty {
|
public class EdmPropertyImpl extends AbstractEdmNamed implements EdmProperty, EdmElement {
|
||||||
|
|
||||||
private final FullQualifiedName structuredTypeName;
|
private final FullQualifiedName structuredTypeName;
|
||||||
private final Property property;
|
private final Property property;
|
||||||
private final EdmTypeInfo typeInfo;
|
private final EdmTypeInfo typeInfo;
|
||||||
private EdmAnnotationHelperImpl helper;
|
|
||||||
private EdmType propertyType;
|
private EdmType propertyType;
|
||||||
|
|
||||||
public EdmPropertyImpl(final Edm edm, final FullQualifiedName structuredTypeName, final Property property) {
|
public EdmPropertyImpl(final Edm edm, final FullQualifiedName structuredTypeName, final Property property) {
|
||||||
super(edm, property.getName());
|
super(edm, property.getName(), property);
|
||||||
|
|
||||||
this.structuredTypeName = structuredTypeName;
|
this.structuredTypeName = structuredTypeName;
|
||||||
this.property = property;
|
this.property = property;
|
||||||
typeInfo = new EdmTypeInfo.Builder().setEdm(edm).setTypeExpression(property.getType().toString()).build();
|
typeInfo = new EdmTypeInfo.Builder().setEdm(edm).setTypeExpression(property.getType().toString()).build();
|
||||||
this.helper = new EdmAnnotationHelperImpl(edm, property);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -125,16 +120,6 @@ public class EdmPropertyImpl extends EdmElementImpl implements EdmProperty {
|
||||||
return structuredTypeName;
|
return structuredTypeName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public EdmAnnotation getAnnotation(final EdmTerm term) {
|
|
||||||
return helper.getAnnotation(term);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<EdmAnnotation> getAnnotations() {
|
|
||||||
return helper.getAnnotations();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isPrimitive() {
|
public boolean isPrimitive() {
|
||||||
return typeInfo.isPrimitiveType();
|
return typeInfo.isPrimitiveType();
|
||||||
|
|
|
@ -18,22 +18,17 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.olingo.commons.core.edm.provider;
|
package org.apache.olingo.commons.core.edm.provider;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.olingo.commons.api.edm.Edm;
|
import org.apache.olingo.commons.api.edm.Edm;
|
||||||
import org.apache.olingo.commons.api.edm.EdmAnnotation;
|
|
||||||
import org.apache.olingo.commons.api.edm.EdmReferentialConstraint;
|
import org.apache.olingo.commons.api.edm.EdmReferentialConstraint;
|
||||||
import org.apache.olingo.commons.api.edm.EdmTerm;
|
|
||||||
import org.apache.olingo.commons.api.edm.provider.ReferentialConstraint;
|
import org.apache.olingo.commons.api.edm.provider.ReferentialConstraint;
|
||||||
|
|
||||||
public class EdmReferentialConstraintImpl implements EdmReferentialConstraint {
|
public class EdmReferentialConstraintImpl extends AbstractEdmAnnotatable implements EdmReferentialConstraint {
|
||||||
|
|
||||||
private final EdmAnnotationHelperImpl helper;
|
|
||||||
private final ReferentialConstraint constraint;
|
private final ReferentialConstraint constraint;
|
||||||
|
|
||||||
public EdmReferentialConstraintImpl(final Edm edm, final ReferentialConstraint constraint) {
|
public EdmReferentialConstraintImpl(final Edm edm, final ReferentialConstraint constraint) {
|
||||||
|
super(edm, constraint);
|
||||||
this.constraint = constraint;
|
this.constraint = constraint;
|
||||||
this.helper = new EdmAnnotationHelperImpl(edm, constraint);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -45,14 +40,4 @@ public class EdmReferentialConstraintImpl implements EdmReferentialConstraint {
|
||||||
public String getReferencedPropertyName() {
|
public String getReferencedPropertyName() {
|
||||||
return constraint.getReferencedProperty();
|
return constraint.getReferencedProperty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public EdmAnnotation getAnnotation(final EdmTerm term) {
|
|
||||||
return helper.getAnnotation(term);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<EdmAnnotation> getAnnotations() {
|
|
||||||
return helper.getAnnotations();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ import org.apache.olingo.commons.api.edm.EdmEntityContainer;
|
||||||
import org.apache.olingo.commons.api.edm.EdmSingleton;
|
import org.apache.olingo.commons.api.edm.EdmSingleton;
|
||||||
import org.apache.olingo.commons.api.edm.provider.Singleton;
|
import org.apache.olingo.commons.api.edm.provider.Singleton;
|
||||||
|
|
||||||
public class EdmSingletonImpl extends EdmBindingTargetImpl implements EdmSingleton {
|
public class EdmSingletonImpl extends AbstractEdmBindingTarget implements EdmSingleton {
|
||||||
|
|
||||||
public EdmSingletonImpl(final Edm edm, final EdmEntityContainer container, final Singleton singleton) {
|
public EdmSingletonImpl(final Edm edm, final EdmEntityContainer container, final Singleton singleton) {
|
||||||
super(edm, container, singleton);
|
super(edm, container, singleton);
|
||||||
|
|
|
@ -23,7 +23,6 @@ import java.util.List;
|
||||||
|
|
||||||
import org.apache.commons.lang3.ClassUtils;
|
import org.apache.commons.lang3.ClassUtils;
|
||||||
import org.apache.olingo.commons.api.edm.Edm;
|
import org.apache.olingo.commons.api.edm.Edm;
|
||||||
import org.apache.olingo.commons.api.edm.EdmAnnotation;
|
|
||||||
import org.apache.olingo.commons.api.edm.EdmException;
|
import org.apache.olingo.commons.api.edm.EdmException;
|
||||||
import org.apache.olingo.commons.api.edm.EdmTerm;
|
import org.apache.olingo.commons.api.edm.EdmTerm;
|
||||||
import org.apache.olingo.commons.api.edm.EdmType;
|
import org.apache.olingo.commons.api.edm.EdmType;
|
||||||
|
@ -34,24 +33,22 @@ import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
public class EdmTermImpl extends EdmNamedImpl implements EdmTerm {
|
public class EdmTermImpl extends AbstractEdmNamed implements EdmTerm {
|
||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(EdmTermImpl.class);
|
private static final Logger LOG = LoggerFactory.getLogger(EdmTermImpl.class);
|
||||||
private final Term term;
|
private final Term term;
|
||||||
private final FullQualifiedName fqn;
|
private final FullQualifiedName fqn;
|
||||||
private final EdmTypeInfo typeInfo;
|
private final EdmTypeInfo typeInfo;
|
||||||
private final EdmAnnotationHelperImpl helper;
|
|
||||||
private EdmType termType;
|
private EdmType termType;
|
||||||
private EdmTerm baseTerm;
|
private EdmTerm baseTerm;
|
||||||
private List<Class<?>> appliesTo;
|
private List<Class<?>> appliesTo;
|
||||||
|
|
||||||
public EdmTermImpl(final Edm edm, final String namespace, final Term term) {
|
public EdmTermImpl(final Edm edm, final String namespace, final Term term) {
|
||||||
super(edm, term.getName());
|
super(edm, term.getName(), term);
|
||||||
|
|
||||||
this.term = term;
|
this.term = term;
|
||||||
this.fqn = new FullQualifiedName(namespace, term.getName());
|
this.fqn = new FullQualifiedName(namespace, term.getName());
|
||||||
this.typeInfo = new EdmTypeInfo.Builder().setEdm(edm).setTypeExpression(term.getType()).build();
|
this.typeInfo = new EdmTypeInfo.Builder().setEdm(edm).setTypeExpression(term.getType()).build();
|
||||||
this.helper = new EdmAnnotationHelperImpl(edm, term);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -146,15 +143,4 @@ public class EdmTermImpl extends EdmNamedImpl implements EdmTerm {
|
||||||
public String getAnnotationsTargetPath() {
|
public String getAnnotationsTargetPath() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public EdmAnnotation getAnnotation(final EdmTerm term) {
|
|
||||||
return helper.getAnnotation(term);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<EdmAnnotation> getAnnotations() {
|
|
||||||
return helper.getAnnotations();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,15 +18,11 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.olingo.commons.core.edm.provider;
|
package org.apache.olingo.commons.core.edm.provider;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.olingo.commons.api.edm.Edm;
|
import org.apache.olingo.commons.api.edm.Edm;
|
||||||
import org.apache.olingo.commons.api.edm.EdmAnnotation;
|
|
||||||
import org.apache.olingo.commons.api.edm.EdmException;
|
import org.apache.olingo.commons.api.edm.EdmException;
|
||||||
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
|
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
|
||||||
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
|
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
|
||||||
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
|
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
|
||||||
import org.apache.olingo.commons.api.edm.EdmTerm;
|
|
||||||
import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
|
import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
|
||||||
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
||||||
import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
|
import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
|
||||||
|
@ -34,20 +30,17 @@ import org.apache.olingo.commons.api.edm.geo.SRID;
|
||||||
import org.apache.olingo.commons.api.edm.provider.TypeDefinition;
|
import org.apache.olingo.commons.api.edm.provider.TypeDefinition;
|
||||||
import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
|
import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
|
||||||
|
|
||||||
public class EdmTypeDefinitionImpl extends EdmNamedImpl implements EdmTypeDefinition {
|
public class EdmTypeDefinitionImpl extends AbstractEdmNamed implements EdmTypeDefinition {
|
||||||
|
|
||||||
private TypeDefinition typeDefinition;
|
private TypeDefinition typeDefinition;
|
||||||
private FullQualifiedName typeDefinitionName;
|
private FullQualifiedName typeDefinitionName;
|
||||||
private EdmPrimitiveType edmPrimitiveTypeInstance;
|
private EdmPrimitiveType edmPrimitiveTypeInstance;
|
||||||
private final EdmAnnotationHelperImpl helper;
|
|
||||||
|
|
||||||
public EdmTypeDefinitionImpl(final Edm edm, final FullQualifiedName typeDefinitionName,
|
public EdmTypeDefinitionImpl(final Edm edm, final FullQualifiedName typeDefinitionName,
|
||||||
final TypeDefinition typeDefinition) {
|
final TypeDefinition typeDefinition) {
|
||||||
super(edm, typeDefinitionName.getName());
|
super(edm, typeDefinitionName.getName(), typeDefinition);
|
||||||
this.typeDefinitionName = typeDefinitionName;
|
this.typeDefinitionName = typeDefinitionName;
|
||||||
this.typeDefinition = typeDefinition;
|
this.typeDefinition = typeDefinition;
|
||||||
|
|
||||||
this.helper = new EdmAnnotationHelperImpl(edm, typeDefinition);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -163,19 +156,8 @@ public class EdmTypeDefinitionImpl extends EdmNamedImpl implements EdmTypeDefini
|
||||||
return getFullQualifiedName();
|
return getFullQualifiedName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public EdmAnnotation getAnnotation(final EdmTerm term) {
|
|
||||||
return helper.getAnnotation(term);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<EdmAnnotation> getAnnotations() {
|
|
||||||
return helper.getAnnotations();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getAnnotationsTargetPath() {
|
public String getAnnotationsTargetPath() {
|
||||||
return getName();
|
return getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,14 +22,16 @@ import org.apache.olingo.commons.api.edm.Edm;
|
||||||
import org.apache.olingo.commons.api.edm.EdmType;
|
import org.apache.olingo.commons.api.edm.EdmType;
|
||||||
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
||||||
import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
|
import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
|
||||||
|
import org.apache.olingo.commons.api.edm.provider.Annotatable;
|
||||||
|
|
||||||
public class EdmTypeImpl extends EdmNamedImpl implements EdmType {
|
public class EdmTypeImpl extends AbstractEdmNamed implements EdmType {
|
||||||
|
|
||||||
protected final FullQualifiedName typeName;
|
protected final FullQualifiedName typeName;
|
||||||
protected final EdmTypeKind kind;
|
protected final EdmTypeKind kind;
|
||||||
|
|
||||||
public EdmTypeImpl(final Edm edm, final FullQualifiedName typeName, final EdmTypeKind kind) {
|
public EdmTypeImpl(final Edm edm, final FullQualifiedName typeName, final EdmTypeKind kind,
|
||||||
super(edm, typeName.getName());
|
final Annotatable annotatable) {
|
||||||
|
super(edm, typeName.getName(), annotatable);
|
||||||
this.typeName = typeName;
|
this.typeName = typeName;
|
||||||
this.kind = kind;
|
this.kind = kind;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,9 +35,7 @@ public class EdmTypeInfo {
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
|
|
||||||
private String typeExpression;
|
private String typeExpression;
|
||||||
|
|
||||||
private String defaultNamespace;
|
private String defaultNamespace;
|
||||||
|
|
||||||
private Edm edm;
|
private Edm edm;
|
||||||
|
|
||||||
public Builder setTypeExpression(final String typeExpression) {
|
public Builder setTypeExpression(final String typeExpression) {
|
||||||
|
@ -62,25 +60,15 @@ public class EdmTypeInfo {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final Edm edm;
|
|
||||||
|
|
||||||
private final boolean collection;
|
private final boolean collection;
|
||||||
|
|
||||||
private final FullQualifiedName fullQualifiedName;
|
private final FullQualifiedName fullQualifiedName;
|
||||||
|
|
||||||
private EdmPrimitiveTypeKind primitiveType;
|
private EdmPrimitiveTypeKind primitiveType;
|
||||||
|
|
||||||
private EdmTypeDefinition typeDefinition;
|
private EdmTypeDefinition typeDefinition;
|
||||||
|
|
||||||
private EdmEnumType enumType;
|
private EdmEnumType enumType;
|
||||||
|
|
||||||
private EdmComplexType complexType;
|
private EdmComplexType complexType;
|
||||||
|
|
||||||
private EdmEntityType entityType;
|
private EdmEntityType entityType;
|
||||||
|
|
||||||
private EdmTypeInfo(final Edm edm, final String typeExpression) {
|
private EdmTypeInfo(final Edm edm, final String typeExpression) {
|
||||||
this.edm = edm;
|
|
||||||
|
|
||||||
String baseType;
|
String baseType;
|
||||||
final int collStartIdx = typeExpression.indexOf("Collection(");
|
final int collStartIdx = typeExpression.indexOf("Collection(");
|
||||||
final int collEndIdx = typeExpression.lastIndexOf(')');
|
final int collEndIdx = typeExpression.lastIndexOf(')');
|
||||||
|
@ -105,7 +93,6 @@ public class EdmTypeInfo {
|
||||||
if (lastDotIdx == -1) {
|
if (lastDotIdx == -1) {
|
||||||
namespace = EdmPrimitiveType.EDM_NAMESPACE;
|
namespace = EdmPrimitiveType.EDM_NAMESPACE;
|
||||||
typeName = baseType;
|
typeName = baseType;
|
||||||
baseType = new FullQualifiedName(EdmPrimitiveType.EDM_NAMESPACE, baseType).toString();
|
|
||||||
} else {
|
} else {
|
||||||
namespace = baseType.substring(0, lastDotIdx);
|
namespace = baseType.substring(0, lastDotIdx);
|
||||||
typeName = baseType.substring(lastDotIdx + 1);
|
typeName = baseType.substring(lastDotIdx + 1);
|
||||||
|
@ -115,9 +102,6 @@ public class EdmTypeInfo {
|
||||||
throw new IllegalArgumentException("Null or empty type name in " + typeExpression);
|
throw new IllegalArgumentException("Null or empty type name in " + typeExpression);
|
||||||
}
|
}
|
||||||
|
|
||||||
final StringBuilder exp = new StringBuilder();
|
|
||||||
exp.append(baseType);
|
|
||||||
|
|
||||||
fullQualifiedName = new FullQualifiedName(namespace, typeName);
|
fullQualifiedName = new FullQualifiedName(namespace, typeName);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -125,14 +109,14 @@ public class EdmTypeInfo {
|
||||||
} catch (final IllegalArgumentException e) {
|
} catch (final IllegalArgumentException e) {
|
||||||
primitiveType = null;
|
primitiveType = null;
|
||||||
}
|
}
|
||||||
if (primitiveType == null && this.edm != null) {
|
if (primitiveType == null && edm != null) {
|
||||||
typeDefinition = this.edm.getTypeDefinition(fullQualifiedName);
|
typeDefinition = edm.getTypeDefinition(fullQualifiedName);
|
||||||
if (typeDefinition == null) {
|
if (typeDefinition == null) {
|
||||||
enumType = this.edm.getEnumType(fullQualifiedName);
|
enumType = edm.getEnumType(fullQualifiedName);
|
||||||
if (enumType == null) {
|
if (enumType == null) {
|
||||||
complexType = this.edm.getComplexType(fullQualifiedName);
|
complexType = edm.getComplexType(fullQualifiedName);
|
||||||
if (complexType == null) {
|
if (complexType == null) {
|
||||||
entityType = this.edm.getEntityType(fullQualifiedName);
|
entityType = edm.getEntityType(fullQualifiedName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,25 +18,42 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.olingo.server.core.edm.provider;
|
package org.apache.olingo.server.core.edm.provider;
|
||||||
|
|
||||||
|
import org.apache.olingo.commons.api.edm.EdmAnnotatable;
|
||||||
import org.apache.olingo.commons.api.edm.EdmNamed;
|
import org.apache.olingo.commons.api.edm.EdmNamed;
|
||||||
import org.apache.olingo.commons.core.edm.provider.EdmNamedImpl;
|
import org.apache.olingo.commons.api.edm.provider.Annotatable;
|
||||||
|
import org.apache.olingo.commons.api.edm.provider.Annotation;
|
||||||
|
import org.apache.olingo.commons.core.edm.provider.AbstractEdmNamed;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class EdmNamedImplTest {
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
|
||||||
|
public class AbstractEdmNamedTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getNameTest() {
|
public void getNameTest() {
|
||||||
EdmNamed obj = new EdmNamedImplTester("Name");
|
EdmNamed obj = new EdmNamedImplTester("Name");
|
||||||
assertEquals("Name", obj.getName());
|
assertEquals("Name", obj.getName());
|
||||||
|
EdmAnnotatable an = (EdmAnnotatable) obj;
|
||||||
|
assertNotNull(an.getAnnotations().get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
private class EdmNamedImplTester extends EdmNamedImpl {
|
private class EdmNamedImplTester extends AbstractEdmNamed {
|
||||||
|
|
||||||
public EdmNamedImplTester(final String name) {
|
public EdmNamedImplTester(final String name) {
|
||||||
super(null, name);
|
super(null, name, new AnnoTester());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class AnnoTester implements Annotatable {
|
||||||
|
@Override
|
||||||
|
public List<Annotation> getAnnotations() {
|
||||||
|
Annotation annotation = new Annotation();
|
||||||
|
annotation.setTerm("NS.SimpleTerm");
|
||||||
|
return Arrays.asList(annotation);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -18,13 +18,20 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.olingo.server.core.edm.provider;
|
package org.apache.olingo.server.core.edm.provider;
|
||||||
|
|
||||||
|
import org.apache.olingo.commons.api.edm.EdmAnnotatable;
|
||||||
import org.apache.olingo.commons.api.edm.EdmType;
|
import org.apache.olingo.commons.api.edm.EdmType;
|
||||||
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
||||||
import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
|
import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
|
||||||
|
import org.apache.olingo.commons.api.edm.provider.Annotatable;
|
||||||
|
import org.apache.olingo.commons.api.edm.provider.Annotation;
|
||||||
import org.apache.olingo.commons.core.edm.provider.EdmTypeImpl;
|
import org.apache.olingo.commons.core.edm.provider.EdmTypeImpl;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
|
||||||
public class EdmTypeImplTest {
|
public class EdmTypeImplTest {
|
||||||
|
|
||||||
|
@ -34,12 +41,22 @@ public class EdmTypeImplTest {
|
||||||
assertEquals("name", type.getName());
|
assertEquals("name", type.getName());
|
||||||
assertEquals("namespace", type.getNamespace());
|
assertEquals("namespace", type.getNamespace());
|
||||||
assertEquals(EdmTypeKind.UNDEFINED, type.getKind());
|
assertEquals(EdmTypeKind.UNDEFINED, type.getKind());
|
||||||
|
EdmAnnotatable an = (EdmAnnotatable) type;
|
||||||
|
assertNotNull(an.getAnnotations().get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
private class EdmTypeImplTester extends EdmTypeImpl {
|
private class EdmTypeImplTester extends EdmTypeImpl {
|
||||||
public EdmTypeImplTester(final FullQualifiedName name, final EdmTypeKind kind) {
|
public EdmTypeImplTester(final FullQualifiedName name, final EdmTypeKind kind) {
|
||||||
super(null, name, kind);
|
super(null, name, kind, new AnnoTester());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class AnnoTester implements Annotatable {
|
||||||
|
@Override
|
||||||
|
public List<Annotation> getAnnotations() {
|
||||||
|
Annotation annotation = new Annotation();
|
||||||
|
annotation.setTerm("NS.SimpleTerm");
|
||||||
|
return Arrays.asList(annotation);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue