[OLINGO-263][OLINGO-264] First draft Edm annotation interfaces + client-side implementation (server components have TODO)
This commit is contained in:
parent
6e72b1f3da
commit
726fbe52e3
|
@ -23,7 +23,7 @@ import org.apache.olingo.client.api.communication.header.ODataPreferences;
|
||||||
import org.apache.olingo.client.api.communication.request.batch.CommonBatchRequestFactory;
|
import org.apache.olingo.client.api.communication.request.batch.CommonBatchRequestFactory;
|
||||||
import org.apache.olingo.client.api.communication.request.cud.CommonCUDRequestFactory;
|
import org.apache.olingo.client.api.communication.request.cud.CommonCUDRequestFactory;
|
||||||
import org.apache.olingo.client.api.communication.request.cud.CommonUpdateType;
|
import org.apache.olingo.client.api.communication.request.cud.CommonUpdateType;
|
||||||
import org.apache.olingo.client.api.communication.request.invoke.CommonInvokeRequestFactory;
|
import org.apache.olingo.client.api.communication.request.invoke.InvokeRequestFactory;
|
||||||
import org.apache.olingo.client.api.communication.request.retrieve.CommonRetrieveRequestFactory;
|
import org.apache.olingo.client.api.communication.request.retrieve.CommonRetrieveRequestFactory;
|
||||||
import org.apache.olingo.client.api.communication.request.streamed.CommonStreamedRequestFactory;
|
import org.apache.olingo.client.api.communication.request.streamed.CommonStreamedRequestFactory;
|
||||||
import org.apache.olingo.client.api.op.ClientODataDeserializer;
|
import org.apache.olingo.client.api.op.ClientODataDeserializer;
|
||||||
|
@ -73,7 +73,7 @@ public interface CommonODataClient<UT extends CommonUpdateType> {
|
||||||
|
|
||||||
CommonStreamedRequestFactory getStreamedRequestFactory();
|
CommonStreamedRequestFactory getStreamedRequestFactory();
|
||||||
|
|
||||||
CommonInvokeRequestFactory getInvokeRequestFactory();
|
InvokeRequestFactory getInvokeRequestFactory();
|
||||||
|
|
||||||
CommonBatchRequestFactory getBatchRequestFactory();
|
CommonBatchRequestFactory getBatchRequestFactory();
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ import org.apache.olingo.commons.api.edm.EdmOperation;
|
||||||
/**
|
/**
|
||||||
* OData request factory class.
|
* OData request factory class.
|
||||||
*/
|
*/
|
||||||
public interface CommonInvokeRequestFactory extends Serializable {
|
public interface InvokeRequestFactory extends Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets an invoke request instance.
|
* Gets an invoke request instance.
|
|
@ -18,6 +18,8 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.olingo.client.api.edm.xml;
|
package org.apache.olingo.client.api.edm.xml;
|
||||||
|
|
||||||
|
import org.apache.olingo.commons.api.edm.geo.SRID;
|
||||||
|
|
||||||
public interface CommonProperty extends Named {
|
public interface CommonProperty extends Named {
|
||||||
|
|
||||||
String getType();
|
String getType();
|
||||||
|
@ -34,6 +36,6 @@ public interface CommonProperty extends Named {
|
||||||
|
|
||||||
boolean isUnicode();
|
boolean isUnicode();
|
||||||
|
|
||||||
String getSrid();
|
SRID getSrid();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,9 +32,9 @@ public interface Schema {
|
||||||
|
|
||||||
EnumType getEnumType(String name);
|
EnumType getEnumType(String name);
|
||||||
|
|
||||||
List<? extends CommonAnnotations> getAnnotationsList();
|
List<? extends CommonAnnotations> getAnnotationGroups();
|
||||||
|
|
||||||
CommonAnnotations getAnnotationsList(String target);
|
CommonAnnotations getAnnotationGroup(String target);
|
||||||
|
|
||||||
List<? extends ComplexType> getComplexTypes();
|
List<? extends ComplexType> getComplexTypes();
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,9 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.olingo.client.api.edm.xml.v3;
|
package org.apache.olingo.client.api.edm.xml.v3;
|
||||||
|
|
||||||
public interface Parameter extends org.apache.olingo.client.api.edm.xml.CommonParameter {
|
import org.apache.olingo.client.api.edm.xml.CommonParameter;
|
||||||
|
|
||||||
|
public interface Parameter extends CommonParameter {
|
||||||
|
|
||||||
ParameterMode getMode();
|
ParameterMode getMode();
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ import java.util.List;
|
||||||
|
|
||||||
import org.apache.olingo.client.api.edm.xml.Named;
|
import org.apache.olingo.client.api.edm.xml.Named;
|
||||||
|
|
||||||
public interface Action extends Named {
|
public interface Action extends Named, Annotatable {
|
||||||
|
|
||||||
boolean isBound();
|
boolean isBound();
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,9 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.olingo.client.api.edm.xml.v4;
|
package org.apache.olingo.client.api.edm.xml.v4;
|
||||||
|
|
||||||
public interface AnnotatedEdmItem {
|
import java.util.List;
|
||||||
|
|
||||||
Annotation getAnnotation();
|
public interface Annotatable {
|
||||||
|
|
||||||
|
List<Annotation> getAnnotations();
|
||||||
}
|
}
|
|
@ -18,16 +18,13 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.olingo.client.api.edm.xml.v4;
|
package org.apache.olingo.client.api.edm.xml.v4;
|
||||||
|
|
||||||
import org.apache.olingo.client.api.edm.xml.v4.annotation.ConstExprConstruct;
|
import org.apache.olingo.client.api.edm.xml.v4.annotation.AnnotationExpression;
|
||||||
import org.apache.olingo.client.api.edm.xml.v4.annotation.DynExprConstruct;
|
|
||||||
|
|
||||||
public interface Annotation {
|
public interface Annotation extends Annotatable {
|
||||||
|
|
||||||
String getTerm();
|
String getTerm();
|
||||||
|
|
||||||
String getQualifier();
|
String getQualifier();
|
||||||
|
|
||||||
ConstExprConstruct getConstExpr();
|
AnnotationExpression getExpression();
|
||||||
|
|
||||||
DynExprConstruct getDynExpr();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ import java.util.List;
|
||||||
|
|
||||||
import org.apache.olingo.client.api.edm.xml.Named;
|
import org.apache.olingo.client.api.edm.xml.Named;
|
||||||
|
|
||||||
public interface BindingTarget extends Named, AnnotatedEdmItem {
|
public interface BindingTarget extends Named, Annotatable {
|
||||||
|
|
||||||
List<? extends NavigationPropertyBinding> getNavigationPropertyBindings();
|
List<? extends NavigationPropertyBinding> getNavigationPropertyBindings();
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ package org.apache.olingo.client.api.edm.xml.v4;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface ComplexType extends org.apache.olingo.client.api.edm.xml.ComplexType, AnnotatedEdmItem {
|
public interface ComplexType extends org.apache.olingo.client.api.edm.xml.ComplexType, Annotatable {
|
||||||
|
|
||||||
boolean isAbstractEntityType();
|
boolean isAbstractEntityType();
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ package org.apache.olingo.client.api.edm.xml.v4;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface EntityContainer extends org.apache.olingo.client.api.edm.xml.EntityContainer {
|
public interface EntityContainer extends org.apache.olingo.client.api.edm.xml.EntityContainer, Annotatable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
EntitySet getEntitySet(String name);
|
EntitySet getEntitySet(String name);
|
||||||
|
|
|
@ -22,7 +22,7 @@ public interface IncludeAnnotations {
|
||||||
|
|
||||||
String getQualifier();
|
String getQualifier();
|
||||||
|
|
||||||
String getTargeyNamespace();
|
String getTargetNamespace();
|
||||||
|
|
||||||
String getTermNamespace();
|
String getTermNamespace();
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ import org.apache.olingo.client.api.edm.xml.OnDelete;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.olingo.client.api.edm.xml.CommonNavigationProperty;
|
import org.apache.olingo.client.api.edm.xml.CommonNavigationProperty;
|
||||||
|
|
||||||
public interface NavigationProperty extends CommonNavigationProperty, AnnotatedEdmItem {
|
public interface NavigationProperty extends CommonNavigationProperty, Annotatable {
|
||||||
|
|
||||||
String getType();
|
String getType();
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ package org.apache.olingo.client.api.edm.xml.v4;
|
||||||
|
|
||||||
import org.apache.olingo.client.api.edm.xml.Named;
|
import org.apache.olingo.client.api.edm.xml.Named;
|
||||||
|
|
||||||
public interface OperationImport extends Named, AnnotatedEdmItem {
|
public interface OperationImport extends Named, Annotatable {
|
||||||
|
|
||||||
String getEntitySet();
|
String getEntitySet();
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,10 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.olingo.client.api.edm.xml.v4;
|
package org.apache.olingo.client.api.edm.xml.v4;
|
||||||
|
|
||||||
public interface Parameter extends org.apache.olingo.client.api.edm.xml.CommonParameter {
|
import org.apache.olingo.client.api.edm.xml.CommonParameter;
|
||||||
|
import org.apache.olingo.commons.api.edm.geo.SRID;
|
||||||
|
|
||||||
String getSrid();
|
public interface Parameter extends CommonParameter, Annotatable {
|
||||||
|
|
||||||
|
SRID getSrid();
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,6 @@ package org.apache.olingo.client.api.edm.xml.v4;
|
||||||
|
|
||||||
import org.apache.olingo.client.api.edm.xml.CommonProperty;
|
import org.apache.olingo.client.api.edm.xml.CommonProperty;
|
||||||
|
|
||||||
public interface Property extends CommonProperty, AnnotatedEdmItem {
|
public interface Property extends CommonProperty, Annotatable {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.olingo.client.api.edm.xml.v4;
|
package org.apache.olingo.client.api.edm.xml.v4;
|
||||||
|
|
||||||
public interface ReferentialConstraint {
|
public interface ReferentialConstraint extends Annotatable {
|
||||||
|
|
||||||
String getProperty();
|
String getProperty();
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,8 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.olingo.client.api.edm.xml.v4;
|
package org.apache.olingo.client.api.edm.xml.v4;
|
||||||
|
|
||||||
|
import org.apache.olingo.commons.api.edm.geo.SRID;
|
||||||
|
|
||||||
public interface ReturnType {
|
public interface ReturnType {
|
||||||
|
|
||||||
Integer getMaxLength();
|
Integer getMaxLength();
|
||||||
|
@ -26,7 +28,7 @@ public interface ReturnType {
|
||||||
|
|
||||||
Integer getScale();
|
Integer getScale();
|
||||||
|
|
||||||
String getSrid();
|
SRID getSrid();
|
||||||
|
|
||||||
String getType();
|
String getType();
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,9 @@
|
||||||
package org.apache.olingo.client.api.edm.xml.v4;
|
package org.apache.olingo.client.api.edm.xml.v4;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public interface Schema extends org.apache.olingo.client.api.edm.xml.Schema, AnnotatedEdmItem {
|
public interface Schema extends org.apache.olingo.client.api.edm.xml.Schema, Annotatable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
List<EntityContainer> getEntityContainers();
|
List<EntityContainer> getEntityContainers();
|
||||||
|
@ -43,12 +44,16 @@ public interface Schema extends org.apache.olingo.client.api.edm.xml.Schema, Ann
|
||||||
|
|
||||||
List<Action> getActions(String name);
|
List<Action> getActions(String name);
|
||||||
|
|
||||||
List<Annotation> getAnnotations();
|
Annotation getAnnotation(String term);
|
||||||
|
|
||||||
|
Map<String, Annotatable> getAnnotatables();
|
||||||
|
|
||||||
List<Function> getFunctions();
|
List<Function> getFunctions();
|
||||||
|
|
||||||
List<Function> getFunctions(String name);
|
List<Function> getFunctions(String name);
|
||||||
|
|
||||||
|
Term getTerm(String name);
|
||||||
|
|
||||||
List<Term> getTerms();
|
List<Term> getTerms();
|
||||||
|
|
||||||
TypeDefinition getTypeDefinition(String name);
|
TypeDefinition getTypeDefinition(String name);
|
||||||
|
@ -56,9 +61,9 @@ public interface Schema extends org.apache.olingo.client.api.edm.xml.Schema, Ann
|
||||||
List<TypeDefinition> getTypeDefinitions();
|
List<TypeDefinition> getTypeDefinitions();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
List<Annotations> getAnnotationsList();
|
List<Annotations> getAnnotationGroups();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
Annotations getAnnotationsList(String target);
|
Annotations getAnnotationGroup(String target);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,12 +19,12 @@
|
||||||
package org.apache.olingo.client.api.edm.xml.v4;
|
package org.apache.olingo.client.api.edm.xml.v4;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.olingo.client.api.edm.xml.Named;
|
import org.apache.olingo.client.api.edm.xml.Named;
|
||||||
|
import org.apache.olingo.commons.api.edm.geo.SRID;
|
||||||
|
|
||||||
public interface Term extends Named {
|
public interface Term extends Named, Annotatable {
|
||||||
|
|
||||||
List<CSDLElement> getAppliesTo();
|
List<String> getAppliesTo();
|
||||||
|
|
||||||
String getBaseTerm();
|
String getBaseTerm();
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ public interface Term extends Named {
|
||||||
|
|
||||||
Integer getScale();
|
Integer getScale();
|
||||||
|
|
||||||
String getSrid();
|
SRID getSrid();
|
||||||
|
|
||||||
String getType();
|
String getType();
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,9 @@ package org.apache.olingo.client.api.edm.xml.v4;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.olingo.client.api.edm.xml.Named;
|
import org.apache.olingo.client.api.edm.xml.Named;
|
||||||
|
import org.apache.olingo.commons.api.edm.geo.SRID;
|
||||||
|
|
||||||
public interface TypeDefinition extends Named {
|
public interface TypeDefinition extends Named, Annotatable {
|
||||||
|
|
||||||
List<Annotation> getAnnotations();
|
List<Annotation> getAnnotations();
|
||||||
|
|
||||||
|
@ -32,7 +33,7 @@ public interface TypeDefinition extends Named {
|
||||||
|
|
||||||
Integer getScale();
|
Integer getScale();
|
||||||
|
|
||||||
String getSrid();
|
SRID getSrid();
|
||||||
|
|
||||||
String getUnderlyingType();
|
String getUnderlyingType();
|
||||||
|
|
||||||
|
|
|
@ -16,9 +16,15 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.olingo.client.api.communication.request.invoke.v4;
|
package org.apache.olingo.client.api.edm.xml.v4.annotation;
|
||||||
|
|
||||||
import org.apache.olingo.client.api.communication.request.invoke.CommonInvokeRequestFactory;
|
public interface AnnotationExpression {
|
||||||
|
|
||||||
public interface InvokeRequestFactory extends CommonInvokeRequestFactory {
|
boolean isConstant();
|
||||||
|
|
||||||
|
ConstantAnnotationExpression asConstant();
|
||||||
|
|
||||||
|
boolean isDynamic();
|
||||||
|
|
||||||
|
DynamicAnnotationExpression asDynamic();
|
||||||
}
|
}
|
|
@ -16,10 +16,10 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.olingo.client.core.edm.xml.v4.annotation;
|
package org.apache.olingo.client.api.edm.xml.v4.annotation;
|
||||||
|
|
||||||
public class AnnotationPath extends AbstractElOrAttrConstruct {
|
public interface AnnotationPath extends DynamicAnnotationExpression {
|
||||||
|
|
||||||
private static final long serialVersionUID = 6198019768659098819L;
|
String getValue();
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
/*
|
||||||
|
* 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.client.api.edm.xml.v4.annotation;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.olingo.client.api.edm.xml.v4.Annotatable;
|
||||||
|
|
||||||
|
public interface Apply extends DynamicAnnotationExpression, Annotatable {
|
||||||
|
|
||||||
|
String getFunction();
|
||||||
|
|
||||||
|
List<AnnotationExpression> getParameters();
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
package org.apache.olingo.client.api.edm.xml.v4.annotation;
|
||||||
|
|
||||||
|
import org.apache.olingo.client.api.edm.xml.v4.Annotatable;
|
||||||
|
import org.apache.olingo.commons.api.edm.geo.SRID;
|
||||||
|
|
||||||
|
public interface Cast extends DynamicAnnotationExpression, Annotatable {
|
||||||
|
|
||||||
|
Integer getMaxLength();
|
||||||
|
|
||||||
|
Integer getPrecision();
|
||||||
|
|
||||||
|
Integer getScale();
|
||||||
|
|
||||||
|
SRID getSrid();
|
||||||
|
|
||||||
|
String getType();
|
||||||
|
|
||||||
|
DynamicAnnotationExpression getValue();
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
/*
|
||||||
|
* 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.client.api.edm.xml.v4.annotation;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface Collection extends DynamicAnnotationExpression {
|
||||||
|
|
||||||
|
List<AnnotationExpression> getItems();
|
||||||
|
|
||||||
|
}
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.olingo.client.api.edm.xml.v4.annotation;
|
package org.apache.olingo.client.api.edm.xml.v4.annotation;
|
||||||
|
|
||||||
public interface ConstExprConstruct extends ExprConstruct {
|
public interface ConstantAnnotationExpression extends AnnotationExpression {
|
||||||
|
|
||||||
public enum Type {
|
public enum Type {
|
||||||
|
|
|
@ -0,0 +1,91 @@
|
||||||
|
/*
|
||||||
|
* 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.client.api.edm.xml.v4.annotation;
|
||||||
|
|
||||||
|
public interface DynamicAnnotationExpression extends AnnotationExpression {
|
||||||
|
|
||||||
|
boolean isNot();
|
||||||
|
|
||||||
|
Not asNot();
|
||||||
|
|
||||||
|
boolean isTwoParamsOp();
|
||||||
|
|
||||||
|
TwoParamsOpDynamicAnnotationExpression asTwoParamsOp();
|
||||||
|
|
||||||
|
boolean isAnnotationPath();
|
||||||
|
|
||||||
|
AnnotationPath asAnnotationPath();
|
||||||
|
|
||||||
|
boolean isApply();
|
||||||
|
|
||||||
|
Apply asApply();
|
||||||
|
|
||||||
|
boolean isCast();
|
||||||
|
|
||||||
|
Cast asCast();
|
||||||
|
|
||||||
|
boolean isCollection();
|
||||||
|
|
||||||
|
Collection asCollection();
|
||||||
|
|
||||||
|
boolean isIf();
|
||||||
|
|
||||||
|
If asIf();
|
||||||
|
|
||||||
|
boolean isIsOf();
|
||||||
|
|
||||||
|
IsOf asIsOf();
|
||||||
|
|
||||||
|
boolean isLabeledElement();
|
||||||
|
|
||||||
|
LabeledElement asLabeledElement();
|
||||||
|
|
||||||
|
boolean isLabeledElementReference();
|
||||||
|
|
||||||
|
LabeledElementReference asLabeledElementReference();
|
||||||
|
|
||||||
|
boolean isNull();
|
||||||
|
|
||||||
|
Null asNull();
|
||||||
|
|
||||||
|
boolean isNavigationPropertyPath();
|
||||||
|
|
||||||
|
NavigationPropertyPath asNavigationPropertyPath();
|
||||||
|
|
||||||
|
boolean isPath();
|
||||||
|
|
||||||
|
Path asPath();
|
||||||
|
|
||||||
|
boolean isPropertyPath();
|
||||||
|
|
||||||
|
PropertyPath asPropertyPath();
|
||||||
|
|
||||||
|
boolean isPropertyValue();
|
||||||
|
|
||||||
|
PropertyValue asPropertyValue();
|
||||||
|
|
||||||
|
boolean isRecord();
|
||||||
|
|
||||||
|
Record asRecord();
|
||||||
|
|
||||||
|
boolean isUrlRef();
|
||||||
|
|
||||||
|
UrlRef asUrlRef();
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
/*
|
||||||
|
* 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.client.api.edm.xml.v4.annotation;
|
||||||
|
|
||||||
|
import org.apache.olingo.client.api.edm.xml.v4.Annotatable;
|
||||||
|
|
||||||
|
public interface If extends DynamicAnnotationExpression, Annotatable {
|
||||||
|
|
||||||
|
AnnotationExpression getGuard();
|
||||||
|
|
||||||
|
AnnotationExpression getThen();
|
||||||
|
|
||||||
|
AnnotationExpression getElse();
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
package org.apache.olingo.client.api.edm.xml.v4.annotation;
|
||||||
|
|
||||||
|
import org.apache.olingo.client.api.edm.xml.v4.Annotatable;
|
||||||
|
import org.apache.olingo.commons.api.edm.geo.SRID;
|
||||||
|
|
||||||
|
public interface IsOf extends DynamicAnnotationExpression, Annotatable {
|
||||||
|
|
||||||
|
Integer getMaxLength();
|
||||||
|
|
||||||
|
Integer getPrecision();
|
||||||
|
|
||||||
|
Integer getScale();
|
||||||
|
|
||||||
|
SRID getSrid();
|
||||||
|
|
||||||
|
String getType();
|
||||||
|
|
||||||
|
DynamicAnnotationExpression getValue();
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
/*
|
||||||
|
* 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.client.api.edm.xml.v4.annotation;
|
||||||
|
|
||||||
|
import org.apache.olingo.client.api.edm.xml.v4.Annotatable;
|
||||||
|
|
||||||
|
public interface LabeledElement extends DynamicAnnotationExpression, Annotatable {
|
||||||
|
|
||||||
|
String getName();
|
||||||
|
|
||||||
|
DynamicAnnotationExpression getValue();
|
||||||
|
|
||||||
|
}
|
|
@ -16,10 +16,10 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.olingo.client.core.edm.xml.v4.annotation;
|
package org.apache.olingo.client.api.edm.xml.v4.annotation;
|
||||||
|
|
||||||
public class LabeledElementReference extends AbstractElOrAttrConstruct {
|
public interface LabeledElementReference extends DynamicAnnotationExpression {
|
||||||
|
|
||||||
private static final long serialVersionUID = 3649068436729494270L;
|
String getValue();
|
||||||
|
|
||||||
}
|
}
|
|
@ -16,10 +16,10 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.olingo.client.core.edm.xml.v4.annotation;
|
package org.apache.olingo.client.api.edm.xml.v4.annotation;
|
||||||
|
|
||||||
public class NavigationPropertyPath extends AbstractElOrAttrConstruct {
|
public interface NavigationPropertyPath extends DynamicAnnotationExpression {
|
||||||
|
|
||||||
private static final long serialVersionUID = -8066400142504963043L;
|
String getValue();
|
||||||
|
|
||||||
}
|
}
|
|
@ -18,6 +18,7 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.olingo.client.api.edm.xml.v4.annotation;
|
package org.apache.olingo.client.api.edm.xml.v4.annotation;
|
||||||
|
|
||||||
public interface ExprConstruct {
|
public interface Not extends DynamicAnnotationExpression {
|
||||||
|
|
||||||
|
DynamicAnnotationExpression getExpression();
|
||||||
}
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
/*
|
||||||
|
* 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.client.api.edm.xml.v4.annotation;
|
||||||
|
|
||||||
|
import org.apache.olingo.client.api.edm.xml.v4.Annotatable;
|
||||||
|
|
||||||
|
public interface Null extends DynamicAnnotationExpression, Annotatable {
|
||||||
|
|
||||||
|
}
|
|
@ -16,10 +16,10 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.olingo.client.core.edm.xml.v4.annotation;
|
package org.apache.olingo.client.api.edm.xml.v4.annotation;
|
||||||
|
|
||||||
public class Path extends AbstractElOrAttrConstruct {
|
public interface Path extends DynamicAnnotationExpression {
|
||||||
|
|
||||||
private static final long serialVersionUID = -2551058493469292082L;
|
String getValue();
|
||||||
|
|
||||||
}
|
}
|
|
@ -16,10 +16,10 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.olingo.client.core.edm.xml.v4.annotation;
|
package org.apache.olingo.client.api.edm.xml.v4.annotation;
|
||||||
|
|
||||||
public class PropertyPath extends AbstractElOrAttrConstruct {
|
public interface PropertyPath extends DynamicAnnotationExpression {
|
||||||
|
|
||||||
private static final long serialVersionUID = 2328584735437885159L;
|
String getValue();
|
||||||
|
|
||||||
}
|
}
|
|
@ -16,22 +16,14 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.olingo.client.api.edm.xml.v4;
|
package org.apache.olingo.client.api.edm.xml.v4.annotation;
|
||||||
|
|
||||||
public enum CSDLElement {
|
import org.apache.olingo.client.api.edm.xml.v4.Annotatable;
|
||||||
|
|
||||||
ActionImport,
|
public interface PropertyValue extends DynamicAnnotationExpression, Annotatable {
|
||||||
ComplexType,
|
|
||||||
EntityContainer,
|
String getProperty();
|
||||||
EntitySet,
|
|
||||||
EntityType,
|
AnnotationExpression getValue();
|
||||||
EnumType,
|
|
||||||
FunctionImport,
|
|
||||||
Member,
|
|
||||||
NavigationProperty,
|
|
||||||
Property,
|
|
||||||
Singleton,
|
|
||||||
Term,
|
|
||||||
TypeDefinition
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
/*
|
||||||
|
* 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.client.api.edm.xml.v4.annotation;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.olingo.client.api.edm.xml.v4.Annotatable;
|
||||||
|
|
||||||
|
public interface Record extends DynamicAnnotationExpression, Annotatable {
|
||||||
|
|
||||||
|
List<PropertyValue> getPropertyValues();
|
||||||
|
|
||||||
|
String getType();
|
||||||
|
|
||||||
|
}
|
|
@ -16,17 +16,14 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.olingo.client.core.edm.xml.v4.annotation;
|
package org.apache.olingo.client.api.edm.xml.v4.annotation;
|
||||||
|
|
||||||
import org.apache.olingo.client.api.edm.xml.v4.annotation.DynExprConstruct;
|
public interface TwoParamsOpDynamicAnnotationExpression extends DynamicAnnotationExpression {
|
||||||
|
|
||||||
public class DynExprSingleParamOp extends DynExprConstructImpl {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = -7974475975925167731L;
|
|
||||||
|
|
||||||
public static enum Type {
|
public static enum Type {
|
||||||
|
|
||||||
Not,
|
And,
|
||||||
|
Or,
|
||||||
Eq,
|
Eq,
|
||||||
Ne,
|
Ne,
|
||||||
Gt,
|
Gt,
|
||||||
|
@ -43,27 +40,11 @@ public class DynExprSingleParamOp extends DynExprConstructImpl {
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Type type;
|
Type getType();
|
||||||
|
|
||||||
private DynExprConstruct expression;
|
DynamicAnnotationExpression getLeftExpression();
|
||||||
|
|
||||||
public Type getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setType(final Type type) {
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DynExprConstruct getExpression() {
|
|
||||||
return expression;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setExpression(final DynExprConstruct expression) {
|
|
||||||
this.expression = expression;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
DynamicAnnotationExpression getRightExpression();
|
||||||
}
|
}
|
|
@ -18,6 +18,8 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.olingo.client.api.edm.xml.v4.annotation;
|
package org.apache.olingo.client.api.edm.xml.v4.annotation;
|
||||||
|
|
||||||
public interface DynExprConstruct extends ExprConstruct {
|
public interface UrlRef extends DynamicAnnotationExpression {
|
||||||
|
|
||||||
|
AnnotationExpression getValue();
|
||||||
|
|
||||||
}
|
}
|
|
@ -22,7 +22,6 @@ import org.apache.olingo.client.api.CommonODataClient;
|
||||||
import org.apache.olingo.client.api.communication.request.batch.v3.BatchRequestFactory;
|
import org.apache.olingo.client.api.communication.request.batch.v3.BatchRequestFactory;
|
||||||
import org.apache.olingo.client.api.communication.request.cud.v3.CUDRequestFactory;
|
import org.apache.olingo.client.api.communication.request.cud.v3.CUDRequestFactory;
|
||||||
import org.apache.olingo.client.api.communication.request.cud.v3.UpdateType;
|
import org.apache.olingo.client.api.communication.request.cud.v3.UpdateType;
|
||||||
import org.apache.olingo.client.api.communication.request.invoke.v3.InvokeRequestFactory;
|
|
||||||
import org.apache.olingo.client.api.communication.request.retrieve.v3.RetrieveRequestFactory;
|
import org.apache.olingo.client.api.communication.request.retrieve.v3.RetrieveRequestFactory;
|
||||||
import org.apache.olingo.client.api.communication.request.streamed.v3.StreamedRequestFactory;
|
import org.apache.olingo.client.api.communication.request.streamed.v3.StreamedRequestFactory;
|
||||||
import org.apache.olingo.client.api.op.v3.ODataBinder;
|
import org.apache.olingo.client.api.op.v3.ODataBinder;
|
||||||
|
@ -64,9 +63,6 @@ public interface ODataClient extends CommonODataClient<UpdateType> {
|
||||||
@Override
|
@Override
|
||||||
StreamedRequestFactory getStreamedRequestFactory();
|
StreamedRequestFactory getStreamedRequestFactory();
|
||||||
|
|
||||||
@Override
|
|
||||||
InvokeRequestFactory getInvokeRequestFactory();
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
BatchRequestFactory getBatchRequestFactory();
|
BatchRequestFactory getBatchRequestFactory();
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,6 @@ import org.apache.olingo.client.api.CommonODataClient;
|
||||||
import org.apache.olingo.client.api.communication.request.batch.v4.BatchRequestFactory;
|
import org.apache.olingo.client.api.communication.request.batch.v4.BatchRequestFactory;
|
||||||
import org.apache.olingo.client.api.communication.request.cud.v4.CUDRequestFactory;
|
import org.apache.olingo.client.api.communication.request.cud.v4.CUDRequestFactory;
|
||||||
import org.apache.olingo.client.api.communication.request.cud.v4.UpdateType;
|
import org.apache.olingo.client.api.communication.request.cud.v4.UpdateType;
|
||||||
import org.apache.olingo.client.api.communication.request.invoke.v4.InvokeRequestFactory;
|
|
||||||
import org.apache.olingo.client.api.communication.request.retrieve.v4.RetrieveRequestFactory;
|
import org.apache.olingo.client.api.communication.request.retrieve.v4.RetrieveRequestFactory;
|
||||||
import org.apache.olingo.client.api.communication.request.streamed.v4.StreamedRequestFactory;
|
import org.apache.olingo.client.api.communication.request.streamed.v4.StreamedRequestFactory;
|
||||||
import org.apache.olingo.client.api.communication.request.v4.AsyncRequestFactory;
|
import org.apache.olingo.client.api.communication.request.v4.AsyncRequestFactory;
|
||||||
|
@ -67,9 +66,6 @@ public interface ODataClient extends CommonODataClient<UpdateType> {
|
||||||
@Override
|
@Override
|
||||||
StreamedRequestFactory getStreamedRequestFactory();
|
StreamedRequestFactory getStreamedRequestFactory();
|
||||||
|
|
||||||
@Override
|
|
||||||
InvokeRequestFactory getInvokeRequestFactory();
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
BatchRequestFactory getBatchRequestFactory();
|
BatchRequestFactory getBatchRequestFactory();
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,22 +19,15 @@
|
||||||
package org.apache.olingo.client.core.communication.request.invoke;
|
package org.apache.olingo.client.core.communication.request.invoke;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import org.apache.olingo.client.api.CommonODataClient;
|
import org.apache.olingo.client.api.communication.request.invoke.InvokeRequestFactory;
|
||||||
import org.apache.olingo.client.api.communication.request.invoke.CommonInvokeRequestFactory;
|
|
||||||
import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest;
|
import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest;
|
||||||
import org.apache.olingo.commons.api.domain.ODataInvokeResult;
|
import org.apache.olingo.commons.api.domain.ODataInvokeResult;
|
||||||
import org.apache.olingo.commons.api.edm.EdmOperation;
|
import org.apache.olingo.commons.api.edm.EdmOperation;
|
||||||
|
|
||||||
public abstract class AbstractInvokeRequestFactory implements CommonInvokeRequestFactory {
|
public abstract class AbstractInvokeRequestFactory implements InvokeRequestFactory {
|
||||||
|
|
||||||
private static final long serialVersionUID = -906760270085197249L;
|
private static final long serialVersionUID = -906760270085197249L;
|
||||||
|
|
||||||
protected final CommonODataClient client;
|
|
||||||
|
|
||||||
protected AbstractInvokeRequestFactory(final CommonODataClient client) {
|
|
||||||
this.client = client;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <RES extends ODataInvokeResult> ODataInvokeRequest<RES> getInvokeRequest(
|
public <RES extends ODataInvokeResult> ODataInvokeRequest<RES> getInvokeRequest(
|
||||||
final URI uri, final EdmOperation operation) {
|
final URI uri, final EdmOperation operation) {
|
||||||
|
|
|
@ -23,7 +23,6 @@ import java.util.Map;
|
||||||
import org.apache.olingo.client.api.v3.ODataClient;
|
import org.apache.olingo.client.api.v3.ODataClient;
|
||||||
import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest;
|
import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest;
|
||||||
import org.apache.olingo.client.api.communication.request.invoke.ODataNoContent;
|
import org.apache.olingo.client.api.communication.request.invoke.ODataNoContent;
|
||||||
import org.apache.olingo.client.api.communication.request.invoke.v3.InvokeRequestFactory;
|
|
||||||
import org.apache.olingo.commons.api.domain.ODataInvokeResult;
|
import org.apache.olingo.commons.api.domain.ODataInvokeResult;
|
||||||
import org.apache.olingo.commons.api.domain.ODataValue;
|
import org.apache.olingo.commons.api.domain.ODataValue;
|
||||||
import org.apache.olingo.client.api.http.HttpMethod;
|
import org.apache.olingo.client.api.http.HttpMethod;
|
||||||
|
@ -36,12 +35,14 @@ import org.apache.olingo.commons.api.edm.EdmOperation;
|
||||||
import org.apache.olingo.commons.api.edm.EdmReturnType;
|
import org.apache.olingo.commons.api.edm.EdmReturnType;
|
||||||
import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
|
import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
|
||||||
|
|
||||||
public class InvokeRequestFactoryImpl extends AbstractInvokeRequestFactory implements InvokeRequestFactory {
|
public class InvokeRequestFactoryImpl extends AbstractInvokeRequestFactory {
|
||||||
|
|
||||||
private static final long serialVersionUID = -659256862901915496L;
|
private static final long serialVersionUID = -659256862901915496L;
|
||||||
|
|
||||||
|
private final ODataClient client;
|
||||||
|
|
||||||
public InvokeRequestFactoryImpl(final ODataClient client) {
|
public InvokeRequestFactoryImpl(final ODataClient client) {
|
||||||
super(client);
|
this.client = client;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -23,7 +23,6 @@ import java.util.Map;
|
||||||
import org.apache.olingo.client.api.v4.ODataClient;
|
import org.apache.olingo.client.api.v4.ODataClient;
|
||||||
import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest;
|
import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest;
|
||||||
import org.apache.olingo.client.api.communication.request.invoke.ODataNoContent;
|
import org.apache.olingo.client.api.communication.request.invoke.ODataNoContent;
|
||||||
import org.apache.olingo.client.api.communication.request.invoke.v4.InvokeRequestFactory;
|
|
||||||
import org.apache.olingo.client.api.http.HttpMethod;
|
import org.apache.olingo.client.api.http.HttpMethod;
|
||||||
import org.apache.olingo.commons.api.domain.ODataInvokeResult;
|
import org.apache.olingo.commons.api.domain.ODataInvokeResult;
|
||||||
import org.apache.olingo.commons.api.domain.ODataValue;
|
import org.apache.olingo.commons.api.domain.ODataValue;
|
||||||
|
@ -36,12 +35,14 @@ import org.apache.olingo.commons.api.edm.EdmOperation;
|
||||||
import org.apache.olingo.commons.api.edm.EdmReturnType;
|
import org.apache.olingo.commons.api.edm.EdmReturnType;
|
||||||
import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
|
import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
|
||||||
|
|
||||||
public class InvokeRequestFactoryImpl extends AbstractInvokeRequestFactory implements InvokeRequestFactory {
|
public class InvokeRequestFactoryImpl extends AbstractInvokeRequestFactory {
|
||||||
|
|
||||||
private static final long serialVersionUID = 8452737360003104372L;
|
private static final long serialVersionUID = 8452737360003104372L;
|
||||||
|
|
||||||
|
private final ODataClient client;
|
||||||
|
|
||||||
public InvokeRequestFactoryImpl(final ODataClient client) {
|
public InvokeRequestFactoryImpl(final ODataClient client) {
|
||||||
super(client);
|
this.client = client;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
|
|
@ -18,18 +18,23 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.olingo.client.core.edm;
|
package org.apache.olingo.client.core.edm;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import org.apache.olingo.client.api.edm.xml.v4.ActionImport;
|
import org.apache.olingo.client.api.edm.xml.v4.ActionImport;
|
||||||
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
|
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
|
||||||
import org.apache.olingo.commons.api.edm.Edm;
|
import org.apache.olingo.commons.api.edm.Edm;
|
||||||
import org.apache.olingo.commons.api.edm.EdmAction;
|
import org.apache.olingo.commons.api.edm.EdmAction;
|
||||||
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.FullQualifiedName;
|
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
||||||
|
import org.apache.olingo.commons.core.edm.EdmAnnotationHelper;
|
||||||
|
|
||||||
public class EdmActionImportImpl extends EdmOperationImportImpl implements EdmActionImport {
|
public class EdmActionImportImpl extends EdmOperationImportImpl implements EdmActionImport {
|
||||||
|
|
||||||
private final ActionImport actionImport;
|
private final ActionImport actionImport;
|
||||||
|
|
||||||
|
private final EdmAnnotationHelper helper;
|
||||||
|
|
||||||
private FullQualifiedName actionFQN;
|
private FullQualifiedName actionFQN;
|
||||||
|
|
||||||
public EdmActionImportImpl(final Edm edm, final EdmEntityContainer container, final String name,
|
public EdmActionImportImpl(final Edm edm, final EdmEntityContainer container, final String name,
|
||||||
|
@ -37,6 +42,7 @@ public class EdmActionImportImpl extends EdmOperationImportImpl implements EdmAc
|
||||||
|
|
||||||
super(edm, container, name, actionImport.getEntitySet());
|
super(edm, container, name, actionImport.getEntitySet());
|
||||||
this.actionImport = actionImport;
|
this.actionImport = actionImport;
|
||||||
|
this.helper = new EdmAnnotationHelperImpl(edm, actionImport);
|
||||||
}
|
}
|
||||||
|
|
||||||
public FullQualifiedName getActionFQN() {
|
public FullQualifiedName getActionFQN() {
|
||||||
|
@ -52,4 +58,13 @@ public class EdmActionImportImpl extends EdmOperationImportImpl implements EdmAc
|
||||||
return edm.getUnboundAction(getActionFQN());
|
return edm.getUnboundAction(getActionFQN());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TargetType getAnnotationsTargetType() {
|
||||||
|
return TargetType.ActionImport;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EdmAnnotation> getAnnotations() {
|
||||||
|
return helper.getAnnotations();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
/*
|
||||||
|
* 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.client.core.edm;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.olingo.client.api.edm.xml.v4.Annotatable;
|
||||||
|
import org.apache.olingo.client.api.edm.xml.v4.Annotation;
|
||||||
|
import org.apache.olingo.commons.api.edm.Edm;
|
||||||
|
import org.apache.olingo.commons.api.edm.EdmAnnotation;
|
||||||
|
import org.apache.olingo.commons.core.edm.EdmAnnotationHelper;
|
||||||
|
|
||||||
|
public class EdmAnnotationHelperImpl implements EdmAnnotationHelper {
|
||||||
|
|
||||||
|
private final Edm edm;
|
||||||
|
|
||||||
|
private final Annotatable annotatable;
|
||||||
|
|
||||||
|
private List<EdmAnnotation> annotations;
|
||||||
|
|
||||||
|
public EdmAnnotationHelperImpl(final Edm edm, final Annotatable annotatable) {
|
||||||
|
this.edm = edm;
|
||||||
|
this.annotatable = annotatable;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EdmAnnotation> getAnnotations() {
|
||||||
|
if (annotations == null) {
|
||||||
|
annotations = new ArrayList<EdmAnnotation>();
|
||||||
|
for (Annotation annotation : annotatable.getAnnotations()) {
|
||||||
|
annotations.add(new EdmAnnotationImpl(edm, annotation));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return annotations;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,238 @@
|
||||||
|
/*
|
||||||
|
* 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.client.core.edm;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.olingo.client.api.edm.xml.v4.Annotatable;
|
||||||
|
import org.apache.olingo.client.api.edm.xml.v4.Annotation;
|
||||||
|
import org.apache.olingo.client.api.edm.xml.v4.annotation.AnnotationExpression;
|
||||||
|
import org.apache.olingo.client.api.edm.xml.v4.annotation.DynamicAnnotationExpression;
|
||||||
|
import org.apache.olingo.client.api.edm.xml.v4.annotation.PropertyValue;
|
||||||
|
import org.apache.olingo.client.core.edm.v4.annotation.EdmCastImpl;
|
||||||
|
import org.apache.olingo.commons.core.edm.annotation.EdmAnnotationPathImpl;
|
||||||
|
import org.apache.olingo.client.core.edm.v4.annotation.EdmConstantAnnotationExpressionImpl;
|
||||||
|
import org.apache.olingo.client.core.edm.v4.annotation.EdmIsOfImpl;
|
||||||
|
import org.apache.olingo.client.core.edm.v4.annotation.EdmRecordImpl;
|
||||||
|
import org.apache.olingo.commons.api.edm.Edm;
|
||||||
|
import org.apache.olingo.commons.api.edm.EdmAnnotatable;
|
||||||
|
import org.apache.olingo.commons.api.edm.EdmAnnotation;
|
||||||
|
import org.apache.olingo.commons.api.edm.EdmTerm;
|
||||||
|
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
||||||
|
import org.apache.olingo.commons.api.edm.annotation.EdmAnnotationExpression;
|
||||||
|
import org.apache.olingo.commons.api.edm.annotation.EdmDynamicAnnotationExpression;
|
||||||
|
import org.apache.olingo.commons.api.edm.annotation.EdmPropertyValue;
|
||||||
|
import org.apache.olingo.commons.core.edm.EdmAnnotationHelper;
|
||||||
|
import org.apache.olingo.commons.core.edm.annotation.EdmAndImpl;
|
||||||
|
import org.apache.olingo.commons.core.edm.annotation.EdmApplyImpl;
|
||||||
|
import org.apache.olingo.commons.core.edm.annotation.EdmCollectionImpl;
|
||||||
|
import org.apache.olingo.commons.core.edm.annotation.EdmEqImpl;
|
||||||
|
import org.apache.olingo.commons.core.edm.annotation.EdmGeImpl;
|
||||||
|
import org.apache.olingo.commons.core.edm.annotation.EdmGtImpl;
|
||||||
|
import org.apache.olingo.commons.core.edm.annotation.EdmIfImpl;
|
||||||
|
import org.apache.olingo.commons.core.edm.annotation.EdmLabeledElementImpl;
|
||||||
|
import org.apache.olingo.commons.core.edm.annotation.EdmLabeledElementReferenceImpl;
|
||||||
|
import org.apache.olingo.commons.core.edm.annotation.EdmLeImpl;
|
||||||
|
import org.apache.olingo.commons.core.edm.annotation.EdmLtImpl;
|
||||||
|
import org.apache.olingo.commons.core.edm.annotation.EdmNavigationPropertyPathImpl;
|
||||||
|
import org.apache.olingo.commons.core.edm.annotation.EdmNeImpl;
|
||||||
|
import org.apache.olingo.commons.core.edm.annotation.EdmNotImpl;
|
||||||
|
import org.apache.olingo.commons.core.edm.annotation.EdmNullImpl;
|
||||||
|
import org.apache.olingo.commons.core.edm.annotation.EdmOrImpl;
|
||||||
|
import org.apache.olingo.commons.core.edm.annotation.EdmPathImpl;
|
||||||
|
import org.apache.olingo.commons.core.edm.annotation.EdmPropertyPathImpl;
|
||||||
|
import org.apache.olingo.commons.core.edm.annotation.EdmPropertyValueImpl;
|
||||||
|
import org.apache.olingo.commons.core.edm.annotation.EdmUrlRefImpl;
|
||||||
|
|
||||||
|
public class EdmAnnotationImpl implements EdmAnnotation {
|
||||||
|
|
||||||
|
private final Edm edm;
|
||||||
|
|
||||||
|
private final Annotation annotation;
|
||||||
|
|
||||||
|
private final EdmAnnotationHelper helper;
|
||||||
|
|
||||||
|
private EdmTerm term;
|
||||||
|
|
||||||
|
private EdmAnnotationExpression expression;
|
||||||
|
|
||||||
|
public EdmAnnotationImpl(final Edm edm, final Annotation annotation) {
|
||||||
|
this.edm = edm;
|
||||||
|
this.annotation = annotation;
|
||||||
|
this.helper = new EdmAnnotationHelperImpl(edm, annotation);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EdmTerm getTerm() {
|
||||||
|
if (term == null) {
|
||||||
|
term = edm.getTerm(new FullQualifiedName(annotation.getTerm()));
|
||||||
|
}
|
||||||
|
return term;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getQualifier() {
|
||||||
|
return annotation.getQualifier();
|
||||||
|
}
|
||||||
|
|
||||||
|
private EdmAnnotationExpression getExpression(final AnnotationExpression exp) {
|
||||||
|
EdmAnnotationExpression _expression = null;
|
||||||
|
|
||||||
|
if (exp.isConstant()) {
|
||||||
|
_expression = new EdmConstantAnnotationExpressionImpl(edm, exp.asConstant());
|
||||||
|
} else if (annotation.getExpression().isDynamic()) {
|
||||||
|
_expression = getDynamicExpression(exp.asDynamic());
|
||||||
|
}
|
||||||
|
|
||||||
|
return _expression;
|
||||||
|
}
|
||||||
|
|
||||||
|
private EdmDynamicAnnotationExpression getDynamicExpression(final DynamicAnnotationExpression exp) {
|
||||||
|
EdmDynamicAnnotationExpression _expression = null;
|
||||||
|
|
||||||
|
if (exp.isNot()) {
|
||||||
|
_expression = new EdmNotImpl(getDynamicExpression(exp.asNot().getExpression()));
|
||||||
|
} else if (exp.isTwoParamsOp()) {
|
||||||
|
switch (exp.asTwoParamsOp().getType()) {
|
||||||
|
case And:
|
||||||
|
_expression = new EdmAndImpl(
|
||||||
|
getDynamicExpression(exp.asTwoParamsOp().getLeftExpression()),
|
||||||
|
getDynamicExpression(exp.asTwoParamsOp().getRightExpression()));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Or:
|
||||||
|
_expression = new EdmOrImpl(
|
||||||
|
getDynamicExpression(exp.asTwoParamsOp().getLeftExpression()),
|
||||||
|
getDynamicExpression(exp.asTwoParamsOp().getRightExpression()));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Eq:
|
||||||
|
_expression = new EdmEqImpl(
|
||||||
|
getDynamicExpression(exp.asTwoParamsOp().getLeftExpression()),
|
||||||
|
getDynamicExpression(exp.asTwoParamsOp().getRightExpression()));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Ne:
|
||||||
|
_expression = new EdmNeImpl(
|
||||||
|
getDynamicExpression(exp.asTwoParamsOp().getLeftExpression()),
|
||||||
|
getDynamicExpression(exp.asTwoParamsOp().getRightExpression()));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Ge:
|
||||||
|
_expression = new EdmGeImpl(
|
||||||
|
getDynamicExpression(exp.asTwoParamsOp().getLeftExpression()),
|
||||||
|
getDynamicExpression(exp.asTwoParamsOp().getRightExpression()));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Gt:
|
||||||
|
_expression = new EdmGtImpl(
|
||||||
|
getDynamicExpression(exp.asTwoParamsOp().getLeftExpression()),
|
||||||
|
getDynamicExpression(exp.asTwoParamsOp().getRightExpression()));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Le:
|
||||||
|
_expression = new EdmLeImpl(
|
||||||
|
getDynamicExpression(exp.asTwoParamsOp().getLeftExpression()),
|
||||||
|
getDynamicExpression(exp.asTwoParamsOp().getRightExpression()));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Lt:
|
||||||
|
_expression = new EdmLtImpl(
|
||||||
|
getDynamicExpression(exp.asTwoParamsOp().getLeftExpression()),
|
||||||
|
getDynamicExpression(exp.asTwoParamsOp().getRightExpression()));
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
} else if (exp.isAnnotationPath()) {
|
||||||
|
_expression = new EdmAnnotationPathImpl(exp.asAnnotationPath().getValue());
|
||||||
|
} else if (exp.isApply()) {
|
||||||
|
final List<EdmAnnotationExpression> parameters =
|
||||||
|
new ArrayList<EdmAnnotationExpression>(exp.asApply().getParameters().size());
|
||||||
|
for (AnnotationExpression param : exp.asApply().getParameters()) {
|
||||||
|
parameters.add(getExpression(param));
|
||||||
|
}
|
||||||
|
_expression = new EdmApplyImpl(exp.asApply().getFunction(), parameters);
|
||||||
|
} else if (exp.isCast()) {
|
||||||
|
_expression = new EdmCastImpl(edm, exp.asCast(), getDynamicExpression(exp.asCast().getValue()));
|
||||||
|
} else if (exp.isCollection()) {
|
||||||
|
final List<EdmAnnotationExpression> items =
|
||||||
|
new ArrayList<EdmAnnotationExpression>(exp.asCollection().getItems().size());
|
||||||
|
for (AnnotationExpression param : exp.asCollection().getItems()) {
|
||||||
|
items.add(getExpression(param));
|
||||||
|
}
|
||||||
|
_expression = new EdmCollectionImpl(items);
|
||||||
|
} else if (exp.isIf()) {
|
||||||
|
_expression = new EdmIfImpl(
|
||||||
|
getExpression(exp.asIf().getGuard()),
|
||||||
|
getExpression(exp.asIf().getThen()),
|
||||||
|
getExpression(exp.asIf().getElse()));
|
||||||
|
} else if (exp.isIsOf()) {
|
||||||
|
_expression = new EdmIsOfImpl(edm, exp.asIsOf(), getDynamicExpression(exp.asIsOf().getValue()));
|
||||||
|
} else if (exp.isLabeledElement()) {
|
||||||
|
_expression = new EdmLabeledElementImpl(
|
||||||
|
exp.asLabeledElement().getName(), getDynamicExpression(exp.asLabeledElement().getValue()));
|
||||||
|
} else if (exp.isLabeledElementReference()) {
|
||||||
|
_expression = new EdmLabeledElementReferenceImpl(exp.asLabeledElementReference().getValue());
|
||||||
|
} else if (exp.isNull()) {
|
||||||
|
_expression = new EdmNullImpl();
|
||||||
|
} else if (exp.isNavigationPropertyPath()) {
|
||||||
|
_expression = new EdmNavigationPropertyPathImpl(exp.asNavigationPropertyPath().getValue());
|
||||||
|
} else if (exp.isPath()) {
|
||||||
|
_expression = new EdmPathImpl(exp.asPath().getValue());
|
||||||
|
} else if (exp.isPropertyPath()) {
|
||||||
|
_expression = new EdmPropertyPathImpl(exp.asPropertyPath().getValue());
|
||||||
|
} else if (exp.isPropertyValue()) {
|
||||||
|
_expression = new EdmPropertyValueImpl(
|
||||||
|
exp.asPropertyValue().getProperty(), getExpression(exp.asPropertyValue().getValue()));
|
||||||
|
} else if (exp.isRecord()) {
|
||||||
|
final List<EdmPropertyValue> propertyValues =
|
||||||
|
new ArrayList<EdmPropertyValue>(exp.asRecord().getPropertyValues().size());
|
||||||
|
for (PropertyValue propertyValue : exp.asRecord().getPropertyValues()) {
|
||||||
|
propertyValues.add(new EdmPropertyValueImpl(
|
||||||
|
propertyValue.getProperty(), getExpression(propertyValue.getValue())));
|
||||||
|
}
|
||||||
|
_expression = new EdmRecordImpl(edm, exp.asRecord().getType(), propertyValues);
|
||||||
|
} else if (exp.isUrlRef()) {
|
||||||
|
_expression = new EdmUrlRefImpl(getExpression(exp.asUrlRef().getValue()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_expression instanceof EdmAnnotatable && exp instanceof Annotatable) {
|
||||||
|
for (Annotation _annotation : ((Annotatable) exp).getAnnotations()) {
|
||||||
|
((EdmAnnotatable) _expression).getAnnotations().add(new EdmAnnotationImpl(edm, _annotation));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return _expression;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EdmAnnotationExpression getExpression() {
|
||||||
|
if (expression == null) {
|
||||||
|
expression = getExpression(annotation.getExpression());
|
||||||
|
}
|
||||||
|
return expression;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EdmAnnotation> getAnnotations() {
|
||||||
|
return helper.getAnnotations();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,146 @@
|
||||||
|
/*
|
||||||
|
* 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.client.core.edm;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.olingo.client.api.edm.xml.v4.Annotation;
|
||||||
|
import org.apache.olingo.client.api.edm.xml.v4.Annotations;
|
||||||
|
import org.apache.olingo.commons.api.edm.Edm;
|
||||||
|
import org.apache.olingo.commons.api.edm.EdmAnnotation;
|
||||||
|
import org.apache.olingo.commons.api.edm.EdmAnnotations;
|
||||||
|
import org.apache.olingo.commons.api.edm.EdmAnnotationsTarget;
|
||||||
|
import org.apache.olingo.commons.api.edm.EdmEntityContainer;
|
||||||
|
import org.apache.olingo.commons.api.edm.EdmEnumType;
|
||||||
|
import org.apache.olingo.commons.api.edm.EdmSchema;
|
||||||
|
import org.apache.olingo.commons.api.edm.EdmStructuredType;
|
||||||
|
import org.apache.olingo.commons.api.edm.EdmTerm;
|
||||||
|
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
||||||
|
|
||||||
|
public class EdmAnnotationsImpl implements EdmAnnotations {
|
||||||
|
|
||||||
|
private final Edm edm;
|
||||||
|
|
||||||
|
private final EdmSchema schema;
|
||||||
|
|
||||||
|
private final Annotations annotationGroup;
|
||||||
|
|
||||||
|
private EdmAnnotationsTarget target;
|
||||||
|
|
||||||
|
private List<EdmAnnotation> annotations;
|
||||||
|
|
||||||
|
public EdmAnnotationsImpl(final Edm edm, final EdmSchema schema, final Annotations annotationGroup) {
|
||||||
|
this.edm = edm;
|
||||||
|
this.schema = schema;
|
||||||
|
this.annotationGroup = annotationGroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
private EdmAnnotationsTarget getTarget(final EdmStructuredType structured, final String path) {
|
||||||
|
EdmAnnotationsTarget _target = null;
|
||||||
|
if (structured != null) {
|
||||||
|
_target = path == null
|
||||||
|
? structured
|
||||||
|
: structured.getStructuralProperty(path);
|
||||||
|
if (_target == null) {
|
||||||
|
_target = structured.getNavigationProperty(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return _target;
|
||||||
|
}
|
||||||
|
|
||||||
|
private EdmAnnotationsTarget getTarget(final EdmEnumType enumType, final String path) {
|
||||||
|
EdmAnnotationsTarget _target = null;
|
||||||
|
if (enumType != null) {
|
||||||
|
_target = path == null
|
||||||
|
? enumType
|
||||||
|
: enumType.getMember(path);
|
||||||
|
}
|
||||||
|
return _target;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EdmAnnotationsTarget getTarget() {
|
||||||
|
if (target == null) {
|
||||||
|
final String[] splitted = StringUtils.split(annotationGroup.getTarget(), '/');
|
||||||
|
final FullQualifiedName base = new FullQualifiedName(splitted[0]);
|
||||||
|
final String path = splitted.length > 1 ? splitted[1] : null;
|
||||||
|
|
||||||
|
final EdmEntityContainer baseEntityContainer = schema.getEntityContainer(base);
|
||||||
|
|
||||||
|
target = baseEntityContainer == null? null: baseEntityContainer.getActionImport(path);
|
||||||
|
if (target == null) {
|
||||||
|
target = getTarget(edm.getComplexType(base), path);
|
||||||
|
if (target == null) {
|
||||||
|
target = baseEntityContainer;
|
||||||
|
if (target == null) {
|
||||||
|
target = baseEntityContainer == null? null: baseEntityContainer.getEntitySet(path);
|
||||||
|
if (target == null) {
|
||||||
|
target = getTarget(edm.getEntityType(base), path);
|
||||||
|
if (target == null) {
|
||||||
|
target = getTarget(edm.getEnumType(base), path);
|
||||||
|
if (target == null) {
|
||||||
|
target = baseEntityContainer == null? null: baseEntityContainer.getFunctionImport(path);
|
||||||
|
if (target == null) {
|
||||||
|
target = baseEntityContainer == null? null: baseEntityContainer.getSingleton(path);
|
||||||
|
if (target == null) {
|
||||||
|
target = edm.getTerm(base);
|
||||||
|
if (target == null) {
|
||||||
|
target = edm.getTypeDefinition(base);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return target;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getQualifier() {
|
||||||
|
return annotationGroup.getQualifier();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EdmAnnotation getAnnotation(final EdmTerm term) {
|
||||||
|
EdmAnnotation result = null;
|
||||||
|
for (EdmAnnotation annotation : getAnnotations()) {
|
||||||
|
if (term.getFullQualifiedName().equals(annotation.getTerm().getFullQualifiedName())) {
|
||||||
|
result = annotation;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EdmAnnotation> getAnnotations() {
|
||||||
|
if (annotations == null) {
|
||||||
|
annotations = new ArrayList<EdmAnnotation>();
|
||||||
|
for (Annotation annotation : annotationGroup.getAnnotations()) {
|
||||||
|
annotations.add(new EdmAnnotationImpl(edm, annotation));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return annotations;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -25,6 +25,7 @@ import java.util.List;
|
||||||
import org.apache.olingo.client.api.edm.xml.v4.BindingTarget;
|
import org.apache.olingo.client.api.edm.xml.v4.BindingTarget;
|
||||||
import org.apache.olingo.client.api.edm.xml.v4.NavigationPropertyBinding;
|
import org.apache.olingo.client.api.edm.xml.v4.NavigationPropertyBinding;
|
||||||
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.EdmException;
|
import org.apache.olingo.commons.api.edm.EdmException;
|
||||||
|
@ -32,18 +33,23 @@ import org.apache.olingo.commons.api.edm.EdmNavigationPropertyBinding;
|
||||||
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.core.edm.AbstractEdmBindingTarget;
|
import org.apache.olingo.commons.core.edm.AbstractEdmBindingTarget;
|
||||||
|
import org.apache.olingo.commons.core.edm.EdmAnnotationHelper;
|
||||||
import org.apache.olingo.commons.core.edm.EdmNavigationPropertyBindingImpl;
|
import org.apache.olingo.commons.core.edm.EdmNavigationPropertyBindingImpl;
|
||||||
|
|
||||||
public abstract class EdmBindingTargetImpl extends AbstractEdmBindingTarget {
|
public abstract class EdmBindingTargetImpl extends AbstractEdmBindingTarget {
|
||||||
|
|
||||||
private final BindingTarget target;
|
private final BindingTarget target;
|
||||||
|
|
||||||
|
private final EdmAnnotationHelper helper;
|
||||||
|
|
||||||
private List<EdmNavigationPropertyBinding> navigationPropertyBindings;
|
private List<EdmNavigationPropertyBinding> navigationPropertyBindings;
|
||||||
|
|
||||||
public EdmBindingTargetImpl(final Edm edm, final EdmEntityContainer container,
|
public EdmBindingTargetImpl(final Edm edm, final EdmEntityContainer container,
|
||||||
final String name, final FullQualifiedName type, final BindingTarget target) {
|
final String name, final FullQualifiedName type, final BindingTarget target) {
|
||||||
|
|
||||||
super(edm, container, name, type);
|
super(edm, container, name, type);
|
||||||
this.target = target;
|
this.target = target;
|
||||||
|
this.helper = new EdmAnnotationHelperImpl(edm, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -53,8 +59,8 @@ public abstract class EdmBindingTargetImpl extends AbstractEdmBindingTarget {
|
||||||
final List<? extends NavigationPropertyBinding> navigationPropertyBindings = target.getNavigationPropertyBindings();
|
final List<? extends NavigationPropertyBinding> navigationPropertyBindings = target.getNavigationPropertyBindings();
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
for (final Iterator<? extends NavigationPropertyBinding> itor = navigationPropertyBindings.iterator(); itor
|
for (final Iterator<? extends NavigationPropertyBinding> itor = navigationPropertyBindings.iterator(); itor
|
||||||
.hasNext()
|
.hasNext()
|
||||||
&& !found;) {
|
&& !found;) {
|
||||||
|
|
||||||
final NavigationPropertyBinding binding = itor.next();
|
final NavigationPropertyBinding binding = itor.next();
|
||||||
if (binding.getPath().equals(path)) {
|
if (binding.getPath().equals(path)) {
|
||||||
|
@ -95,4 +101,9 @@ public abstract class EdmBindingTargetImpl extends AbstractEdmBindingTarget {
|
||||||
return navigationPropertyBindings;
|
return navigationPropertyBindings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EdmAnnotation> getAnnotations() {
|
||||||
|
return helper.getAnnotations();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,21 +18,19 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.olingo.client.core.edm;
|
package org.apache.olingo.client.core.edm;
|
||||||
|
|
||||||
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.commons.lang3.builder.EqualsBuilder;
|
import org.apache.commons.lang3.builder.EqualsBuilder;
|
||||||
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||||
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
|
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import org.apache.olingo.client.api.v3.UnsupportedInV3Exception;
|
|
||||||
import org.apache.olingo.client.api.edm.xml.CommonParameter;
|
import org.apache.olingo.client.api.edm.xml.CommonParameter;
|
||||||
import org.apache.olingo.client.api.edm.xml.ComplexType;
|
import org.apache.olingo.client.api.edm.xml.ComplexType;
|
||||||
import org.apache.olingo.client.api.edm.xml.EntityContainer;
|
import org.apache.olingo.client.api.edm.xml.EntityContainer;
|
||||||
|
@ -41,12 +39,18 @@ import org.apache.olingo.client.api.edm.xml.EnumType;
|
||||||
import org.apache.olingo.client.api.edm.xml.Schema;
|
import org.apache.olingo.client.api.edm.xml.Schema;
|
||||||
import org.apache.olingo.client.api.edm.xml.v3.FunctionImport;
|
import org.apache.olingo.client.api.edm.xml.v3.FunctionImport;
|
||||||
import org.apache.olingo.client.api.edm.xml.v4.Action;
|
import org.apache.olingo.client.api.edm.xml.v4.Action;
|
||||||
|
import org.apache.olingo.client.api.edm.xml.v4.Annotatable;
|
||||||
|
import org.apache.olingo.client.api.edm.xml.v4.Annotation;
|
||||||
|
import org.apache.olingo.client.api.edm.xml.v4.Annotations;
|
||||||
import org.apache.olingo.client.api.edm.xml.v4.Function;
|
import org.apache.olingo.client.api.edm.xml.v4.Function;
|
||||||
|
import org.apache.olingo.client.api.edm.xml.v4.Term;
|
||||||
import org.apache.olingo.client.api.edm.xml.v4.TypeDefinition;
|
import org.apache.olingo.client.api.edm.xml.v4.TypeDefinition;
|
||||||
import org.apache.olingo.client.core.edm.v3.EdmActionProxy;
|
import org.apache.olingo.client.core.edm.v3.EdmActionProxy;
|
||||||
import org.apache.olingo.client.core.edm.v3.EdmFunctionProxy;
|
import org.apache.olingo.client.core.edm.v3.EdmFunctionProxy;
|
||||||
import org.apache.olingo.client.core.edm.v3.FunctionImportUtils;
|
import org.apache.olingo.client.core.edm.v3.FunctionImportUtils;
|
||||||
import org.apache.olingo.commons.api.edm.EdmAction;
|
import org.apache.olingo.commons.api.edm.EdmAction;
|
||||||
|
import org.apache.olingo.commons.api.edm.EdmAnnotation;
|
||||||
|
import org.apache.olingo.commons.api.edm.EdmAnnotations;
|
||||||
import org.apache.olingo.commons.api.edm.EdmComplexType;
|
import org.apache.olingo.commons.api.edm.EdmComplexType;
|
||||||
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;
|
||||||
|
@ -54,10 +58,12 @@ import org.apache.olingo.commons.api.edm.EdmEnumType;
|
||||||
import org.apache.olingo.commons.api.edm.EdmFunction;
|
import org.apache.olingo.commons.api.edm.EdmFunction;
|
||||||
import org.apache.olingo.commons.api.edm.EdmSchema;
|
import org.apache.olingo.commons.api.edm.EdmSchema;
|
||||||
import org.apache.olingo.commons.api.edm.EdmServiceMetadata;
|
import org.apache.olingo.commons.api.edm.EdmServiceMetadata;
|
||||||
|
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.ODataServiceVersion;
|
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
|
||||||
import org.apache.olingo.commons.core.edm.AbstractEdm;
|
import org.apache.olingo.commons.core.edm.AbstractEdm;
|
||||||
|
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
|
||||||
|
|
||||||
public class EdmClientImpl extends AbstractEdm {
|
public class EdmClientImpl extends AbstractEdm {
|
||||||
|
|
||||||
|
@ -101,6 +107,15 @@ public class EdmClientImpl extends AbstractEdm {
|
||||||
return aliasToNamespace;
|
return aliasToNamespace;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Map<String, EdmSchema> createSchemas() {
|
||||||
|
final Map<String, EdmSchema> _schemas = new LinkedHashMap<String, EdmSchema>(xmlSchemas.size());
|
||||||
|
for (Schema schema : xmlSchemas) {
|
||||||
|
_schemas.put(schema.getNamespace(), new EdmSchemaImpl(version, this, xmlSchemas, schema));
|
||||||
|
}
|
||||||
|
return _schemas;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected EdmEntityContainer createEntityContainer(final FullQualifiedName containerName) {
|
protected EdmEntityContainer createEntityContainer(final FullQualifiedName containerName) {
|
||||||
EdmEntityContainer result = null;
|
EdmEntityContainer result = null;
|
||||||
|
@ -142,8 +157,6 @@ public class EdmClientImpl extends AbstractEdm {
|
||||||
if (xmlTypeDefinition != null) {
|
if (xmlTypeDefinition != null) {
|
||||||
result = new EdmTypeDefinitionImpl(version, this, typeDefinitionName, xmlTypeDefinition);
|
result = new EdmTypeDefinitionImpl(version, this, typeDefinitionName, xmlTypeDefinition);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
throw new UnsupportedInV3Exception();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -407,6 +420,57 @@ public class EdmClientImpl extends AbstractEdm {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected EdmTerm createTerm(final FullQualifiedName termName) {
|
||||||
|
EdmTerm result = null;
|
||||||
|
|
||||||
|
final Schema schema = xmlSchemaByNamespace.get(termName.getNamespace());
|
||||||
|
if (schema instanceof org.apache.olingo.client.api.edm.xml.v4.Schema) {
|
||||||
|
final Term term = ((org.apache.olingo.client.api.edm.xml.v4.Schema) schema).getTerm(termName.getName());
|
||||||
|
if (term != null) {
|
||||||
|
result = new EdmTermImpl(this, term);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected EdmAnnotations createAnnotationGroup(final FullQualifiedName targetName) {
|
||||||
|
EdmAnnotationsImpl result = null;
|
||||||
|
|
||||||
|
final Schema schema = xmlSchemaByNamespace.get(targetName.getNamespace());
|
||||||
|
if (schema instanceof org.apache.olingo.client.api.edm.xml.v4.Schema) {
|
||||||
|
final Annotations annotationGroup =
|
||||||
|
((org.apache.olingo.client.api.edm.xml.v4.Schema) schema).getAnnotationGroup(targetName.getName());
|
||||||
|
if (annotationGroup != null) {
|
||||||
|
result = new EdmAnnotationsImpl(this, schemas.get(schema.getNamespace()), annotationGroup);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<EdmAnnotation> createAnnotations(final FullQualifiedName annotatedName) {
|
||||||
|
List<EdmAnnotation> result = null;
|
||||||
|
|
||||||
|
final Schema schema = xmlSchemaByNamespace.get(annotatedName.getNamespace());
|
||||||
|
if (schema instanceof org.apache.olingo.client.api.edm.xml.v4.Schema) {
|
||||||
|
final Annotatable annotatable =
|
||||||
|
((org.apache.olingo.client.api.edm.xml.v4.Schema) schema).getAnnotatables().get(annotatedName.getName());
|
||||||
|
if (annotatable != null && annotatable.getAnnotations() != null) {
|
||||||
|
result = new ArrayList<EdmAnnotation>();
|
||||||
|
for (Annotation annotation : annotatable.getAnnotations()) {
|
||||||
|
final EdmTerm term = getTerm(new FullQualifiedName(annotation.getTerm()));
|
||||||
|
result.add(new EdmAnnotationImpl(this, annotation));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(final Object obj) {
|
public boolean equals(final Object obj) {
|
||||||
return EqualsBuilder.reflectionEquals(this, obj);
|
return EqualsBuilder.reflectionEquals(this, obj);
|
||||||
|
@ -421,13 +485,4 @@ public class EdmClientImpl extends AbstractEdm {
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
|
return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected List<EdmSchema> createSchemas() {
|
|
||||||
final List<EdmSchema> schemas = new ArrayList<EdmSchema>();
|
|
||||||
for (Schema schema : xmlSchemas) {
|
|
||||||
schemas.add(new EdmSchemaImpl(version, this, xmlSchemas, schema));
|
|
||||||
}
|
|
||||||
return schemas;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,15 +24,19 @@ import java.util.Map;
|
||||||
import org.apache.olingo.client.api.edm.xml.ComplexType;
|
import org.apache.olingo.client.api.edm.xml.ComplexType;
|
||||||
import org.apache.olingo.client.api.edm.xml.Schema;
|
import org.apache.olingo.client.api.edm.xml.Schema;
|
||||||
import org.apache.olingo.commons.api.edm.Edm;
|
import org.apache.olingo.commons.api.edm.Edm;
|
||||||
|
import org.apache.olingo.commons.api.edm.EdmAnnotation;
|
||||||
import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
|
import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
|
||||||
import org.apache.olingo.commons.api.edm.EdmProperty;
|
import org.apache.olingo.commons.api.edm.EdmProperty;
|
||||||
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
||||||
import org.apache.olingo.commons.core.edm.AbstractEdmComplexType;
|
import org.apache.olingo.commons.core.edm.AbstractEdmComplexType;
|
||||||
|
import org.apache.olingo.commons.core.edm.EdmAnnotationHelper;
|
||||||
import org.apache.olingo.commons.core.edm.EdmStructuredTypeHelper;
|
import org.apache.olingo.commons.core.edm.EdmStructuredTypeHelper;
|
||||||
|
|
||||||
public class EdmComplexTypeImpl extends AbstractEdmComplexType {
|
public class EdmComplexTypeImpl extends AbstractEdmComplexType {
|
||||||
|
|
||||||
private final EdmStructuredTypeHelper helper;
|
private final EdmStructuredTypeHelper typeHelper;
|
||||||
|
|
||||||
|
private EdmAnnotationHelper annotationHelper;
|
||||||
|
|
||||||
public static EdmComplexTypeImpl getInstance(final Edm edm, final FullQualifiedName fqn,
|
public static EdmComplexTypeImpl getInstance(final Edm edm, final FullQualifiedName fqn,
|
||||||
final List<? extends Schema> xmlSchemas, final ComplexType complexType) {
|
final List<? extends Schema> xmlSchemas, final ComplexType complexType) {
|
||||||
|
@ -53,26 +57,36 @@ public class EdmComplexTypeImpl extends AbstractEdmComplexType {
|
||||||
final List<? extends Schema> xmlSchemas, final ComplexType complexType) {
|
final List<? extends Schema> xmlSchemas, final ComplexType complexType) {
|
||||||
|
|
||||||
super(edm, fqn, baseTypeName);
|
super(edm, fqn, baseTypeName);
|
||||||
this.helper = new EdmStructuredTypeHelperImpl(edm, xmlSchemas, complexType);
|
this.typeHelper = new EdmStructuredTypeHelperImpl(edm, getFullQualifiedName(), xmlSchemas, complexType);
|
||||||
|
if (complexType instanceof org.apache.olingo.client.api.edm.xml.v4.ComplexType) {
|
||||||
|
this.annotationHelper = new EdmAnnotationHelperImpl(edm,
|
||||||
|
(org.apache.olingo.client.api.edm.xml.v4.ComplexType) complexType);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Map<String, EdmProperty> getProperties() {
|
protected Map<String, EdmProperty> getProperties() {
|
||||||
return helper.getProperties();
|
return typeHelper.getProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Map<String, EdmNavigationProperty> getNavigationProperties() {
|
protected Map<String, EdmNavigationProperty> getNavigationProperties() {
|
||||||
return helper.getNavigationProperties();
|
return typeHelper.getNavigationProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpenType() {
|
public boolean isOpenType() {
|
||||||
return helper.isOpenType();
|
return typeHelper.isOpenType();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAbstract() {
|
public boolean isAbstract() {
|
||||||
return helper.isAbstract();
|
return typeHelper.isAbstract();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EdmAnnotation> getAnnotations() {
|
||||||
|
return annotationHelper == null ? null : annotationHelper.getAnnotations();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.olingo.client.core.edm;
|
package org.apache.olingo.client.core.edm;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
|
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -34,12 +35,13 @@ import org.apache.olingo.client.core.edm.v3.EdmEntitySetProxy;
|
||||||
import org.apache.olingo.client.core.edm.v3.EdmFunctionImportProxy;
|
import org.apache.olingo.client.core.edm.v3.EdmFunctionImportProxy;
|
||||||
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.EdmEntitySet;
|
import org.apache.olingo.commons.api.edm.EdmEntitySet;
|
||||||
import org.apache.olingo.commons.api.edm.EdmException;
|
|
||||||
import org.apache.olingo.commons.api.edm.EdmFunctionImport;
|
import org.apache.olingo.commons.api.edm.EdmFunctionImport;
|
||||||
import org.apache.olingo.commons.api.edm.EdmSingleton;
|
import org.apache.olingo.commons.api.edm.EdmSingleton;
|
||||||
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
||||||
import org.apache.olingo.commons.core.edm.AbstractEdmEntityContainer;
|
import org.apache.olingo.commons.core.edm.AbstractEdmEntityContainer;
|
||||||
|
import org.apache.olingo.commons.core.edm.EdmAnnotationHelper;
|
||||||
|
|
||||||
public class EdmEntityContainerImpl extends AbstractEdmEntityContainer {
|
public class EdmEntityContainerImpl extends AbstractEdmEntityContainer {
|
||||||
|
|
||||||
|
@ -47,6 +49,8 @@ public class EdmEntityContainerImpl extends AbstractEdmEntityContainer {
|
||||||
|
|
||||||
private final List<? extends Schema> xmlSchemas;
|
private final List<? extends Schema> xmlSchemas;
|
||||||
|
|
||||||
|
private EdmAnnotationHelper helper;
|
||||||
|
|
||||||
public EdmEntityContainerImpl(final Edm edm, final FullQualifiedName entityContainerName,
|
public EdmEntityContainerImpl(final Edm edm, final FullQualifiedName entityContainerName,
|
||||||
final EntityContainer xmlEntityContainer, final List<? extends Schema> xmlSchemas) {
|
final EntityContainer xmlEntityContainer, final List<? extends Schema> xmlSchemas) {
|
||||||
|
|
||||||
|
@ -55,6 +59,10 @@ public class EdmEntityContainerImpl extends AbstractEdmEntityContainer {
|
||||||
|
|
||||||
this.xmlEntityContainer = xmlEntityContainer;
|
this.xmlEntityContainer = xmlEntityContainer;
|
||||||
this.xmlSchemas = xmlSchemas;
|
this.xmlSchemas = xmlSchemas;
|
||||||
|
if (xmlEntityContainer instanceof org.apache.olingo.client.api.edm.xml.v4.EntityContainer) {
|
||||||
|
this.helper = new EdmAnnotationHelperImpl(edm,
|
||||||
|
(org.apache.olingo.client.api.edm.xml.v4.EntityContainer) xmlEntityContainer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -72,63 +80,69 @@ public class EdmEntityContainerImpl extends AbstractEdmEntityContainer {
|
||||||
|
|
||||||
final Singleton singleton = ((org.apache.olingo.client.api.edm.xml.v4.EntityContainer) xmlEntityContainer).
|
final Singleton singleton = ((org.apache.olingo.client.api.edm.xml.v4.EntityContainer) xmlEntityContainer).
|
||||||
getSingleton(singletonName);
|
getSingleton(singletonName);
|
||||||
if (singleton == null) {
|
return singleton == null
|
||||||
throw new EdmException("Singleton named '" + singletonName + "' not found in " + entityContainerName);
|
? null
|
||||||
}
|
: new EdmSingletonImpl(edm, this, singletonName, new EdmTypeInfo.Builder().
|
||||||
return new EdmSingletonImpl(edm, this, singletonName, new EdmTypeInfo.Builder().
|
setTypeExpression(singleton.getEntityType()).
|
||||||
setTypeExpression(singleton.getEntityType()).setDefaultNamespace(entityContainerName.getNamespace()).
|
setDefaultNamespace(entityContainerName.getNamespace()).
|
||||||
build().getFullQualifiedName(), singleton);
|
build().getFullQualifiedName(), singleton);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected EdmEntitySet createEntitySet(final String entitySetName) {
|
protected EdmEntitySet createEntitySet(final String entitySetName) {
|
||||||
|
EdmEntitySet result = null;
|
||||||
|
|
||||||
final EntitySet entitySet = xmlEntityContainer.getEntitySet(entitySetName);
|
final EntitySet entitySet = xmlEntityContainer.getEntitySet(entitySetName);
|
||||||
if (entitySet == null) {
|
if (entitySet != null) {
|
||||||
throw new EdmException("EntitySet named '" + entitySetName + "' not found in " + entityContainerName);
|
final FullQualifiedName entityType = new EdmTypeInfo.Builder().setTypeExpression(entitySet.getEntityType()).
|
||||||
|
setDefaultNamespace(entityContainerName.getNamespace()).build().getFullQualifiedName();
|
||||||
|
if (entitySet instanceof org.apache.olingo.client.api.edm.xml.v4.EntitySet) {
|
||||||
|
result = new EdmEntitySetImpl(edm, this, entitySetName, entityType,
|
||||||
|
(org.apache.olingo.client.api.edm.xml.v4.EntitySet) entitySet);
|
||||||
|
} else {
|
||||||
|
result = new EdmEntitySetProxy(edm, this, entitySetName, entityType, xmlSchemas);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final FullQualifiedName entityType = new EdmTypeInfo.Builder().setTypeExpression(entitySet.getEntityType()).
|
return result;
|
||||||
setDefaultNamespace(entityContainerName.getNamespace()).build().getFullQualifiedName();
|
|
||||||
if (entitySet instanceof org.apache.olingo.client.api.edm.xml.v4.EntitySet) {
|
|
||||||
return new EdmEntitySetImpl(edm, this, entitySetName, entityType,
|
|
||||||
(org.apache.olingo.client.api.edm.xml.v4.EntitySet) entitySet);
|
|
||||||
} else {
|
|
||||||
return new EdmEntitySetProxy(edm, this, entitySetName, entityType, xmlSchemas);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected EdmActionImport createActionImport(final String actionImportName) {
|
protected EdmActionImport createActionImport(final String actionImportName) {
|
||||||
|
EdmActionImport result = null;
|
||||||
|
|
||||||
if (xmlEntityContainer instanceof org.apache.olingo.client.api.edm.xml.v4.EntityContainer) {
|
if (xmlEntityContainer instanceof org.apache.olingo.client.api.edm.xml.v4.EntityContainer) {
|
||||||
final ActionImport actionImport = ((org.apache.olingo.client.api.edm.xml.v4.EntityContainer) xmlEntityContainer).
|
final ActionImport actionImport = ((org.apache.olingo.client.api.edm.xml.v4.EntityContainer) xmlEntityContainer).
|
||||||
getActionImport(actionImportName);
|
getActionImport(actionImportName);
|
||||||
if (actionImport == null) {
|
if (actionImport != null) {
|
||||||
throw new EdmException("ActionImport named '" + actionImportName + "' not found in " + entityContainerName);
|
result = new EdmActionImportImpl(edm, this, actionImportName, actionImport);
|
||||||
}
|
}
|
||||||
return new EdmActionImportImpl(edm, this, actionImportName, actionImport);
|
|
||||||
} else {
|
} else {
|
||||||
final FunctionImport functionImport = (FunctionImport) xmlEntityContainer.getFunctionImport(actionImportName);
|
final FunctionImport functionImport = (FunctionImport) xmlEntityContainer.getFunctionImport(actionImportName);
|
||||||
if (functionImport == null) {
|
if (functionImport != null) {
|
||||||
throw new EdmException("FunctionImport named '" + actionImportName + "' not found in " + entityContainerName);
|
result = new EdmActionImportProxy(edm, this, actionImportName, functionImport);
|
||||||
}
|
}
|
||||||
return new EdmActionImportProxy(edm, this, actionImportName, functionImport);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected EdmFunctionImport createFunctionImport(final String functionImportName) {
|
protected EdmFunctionImport createFunctionImport(final String functionImportName) {
|
||||||
|
EdmFunctionImport result = null;
|
||||||
|
|
||||||
final CommonFunctionImport functionImport = xmlEntityContainer.getFunctionImport(functionImportName);
|
final CommonFunctionImport functionImport = xmlEntityContainer.getFunctionImport(functionImportName);
|
||||||
if (functionImport == null) {
|
if (functionImport != null) {
|
||||||
throw new EdmException("FunctionImport named '" + functionImportName + "' not found in " + entityContainerName);
|
if (functionImport instanceof org.apache.olingo.client.api.edm.xml.v4.FunctionImport) {
|
||||||
|
result = new EdmFunctionImportImpl(edm, this, functionImportName,
|
||||||
|
(org.apache.olingo.client.api.edm.xml.v4.FunctionImport) functionImport);
|
||||||
|
} else {
|
||||||
|
result = new EdmFunctionImportProxy(edm, this, functionImportName,
|
||||||
|
(org.apache.olingo.client.api.edm.xml.v3.FunctionImport) functionImport);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (functionImport instanceof org.apache.olingo.client.api.edm.xml.v4.FunctionImport) {
|
return result;
|
||||||
return new EdmFunctionImportImpl(edm, this, functionImportName,
|
|
||||||
(org.apache.olingo.client.api.edm.xml.v4.FunctionImport) functionImport);
|
|
||||||
} else {
|
|
||||||
return new EdmFunctionImportProxy(edm, this, functionImportName,
|
|
||||||
(org.apache.olingo.client.api.edm.xml.v3.FunctionImport) functionImport);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -209,4 +223,15 @@ public class EdmEntityContainerImpl extends AbstractEdmEntityContainer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TargetType getAnnotationsTargetType() {
|
||||||
|
return TargetType.EntityContainer;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EdmAnnotation> getAnnotations() {
|
||||||
|
return helper == null ? Collections.<EdmAnnotation>emptyList() : helper.getAnnotations();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,12 +26,13 @@ import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
||||||
|
|
||||||
public class EdmEntitySetImpl extends EdmBindingTargetImpl implements EdmEntitySet {
|
public class EdmEntitySetImpl extends EdmBindingTargetImpl implements EdmEntitySet {
|
||||||
|
|
||||||
private EntitySet entitySet;
|
private final EntitySet entitySet;
|
||||||
|
|
||||||
public EdmEntitySetImpl(final Edm edm, final EdmEntityContainer container, final String name,
|
public EdmEntitySetImpl(final Edm edm, final EdmEntityContainer container, final String name,
|
||||||
final FullQualifiedName type, final EntitySet entitySet) {
|
final FullQualifiedName type, final EntitySet entitySet) {
|
||||||
|
|
||||||
super(edm, container, name, type, entitySet);
|
super(edm, container, name, type, entitySet);
|
||||||
|
|
||||||
this.entitySet = entitySet;
|
this.entitySet = entitySet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,4 +40,9 @@ public class EdmEntitySetImpl extends EdmBindingTargetImpl implements EdmEntityS
|
||||||
public boolean isIncludeInServiceDocument() {
|
public boolean isIncludeInServiceDocument() {
|
||||||
return entitySet.isIncludeInServiceDocument();
|
return entitySet.isIncludeInServiceDocument();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TargetType getAnnotationsTargetType() {
|
||||||
|
return TargetType.EntitySet;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,21 +27,25 @@ import org.apache.olingo.client.api.edm.xml.EntityType;
|
||||||
import org.apache.olingo.client.api.edm.xml.PropertyRef;
|
import org.apache.olingo.client.api.edm.xml.PropertyRef;
|
||||||
import org.apache.olingo.client.api.edm.xml.Schema;
|
import org.apache.olingo.client.api.edm.xml.Schema;
|
||||||
import org.apache.olingo.commons.api.edm.Edm;
|
import org.apache.olingo.commons.api.edm.Edm;
|
||||||
|
import org.apache.olingo.commons.api.edm.EdmAnnotation;
|
||||||
import org.apache.olingo.commons.api.edm.EdmEntityType;
|
import org.apache.olingo.commons.api.edm.EdmEntityType;
|
||||||
import org.apache.olingo.commons.api.edm.EdmKeyPropertyRef;
|
import org.apache.olingo.commons.api.edm.EdmKeyPropertyRef;
|
||||||
import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
|
import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
|
||||||
import org.apache.olingo.commons.api.edm.EdmProperty;
|
import org.apache.olingo.commons.api.edm.EdmProperty;
|
||||||
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
||||||
import org.apache.olingo.commons.core.edm.AbstractEdmEntityType;
|
import org.apache.olingo.commons.core.edm.AbstractEdmEntityType;
|
||||||
|
import org.apache.olingo.commons.core.edm.EdmAnnotationHelper;
|
||||||
import org.apache.olingo.commons.core.edm.EdmStructuredTypeHelper;
|
import org.apache.olingo.commons.core.edm.EdmStructuredTypeHelper;
|
||||||
|
|
||||||
public class EdmEntityTypeImpl extends AbstractEdmEntityType {
|
public class EdmEntityTypeImpl extends AbstractEdmEntityType {
|
||||||
|
|
||||||
private final EdmStructuredTypeHelper helper;
|
private final EdmStructuredTypeHelper typeHelper;
|
||||||
|
|
||||||
public static EdmEntityTypeImpl getInstance(final Edm edm, final FullQualifiedName fqn,
|
private EdmAnnotationHelper annotationHelper;
|
||||||
|
|
||||||
|
public static EdmEntityTypeImpl getInstance(final Edm edm, final FullQualifiedName fqn,
|
||||||
final List<? extends Schema> xmlSchemas, final EntityType entityType) {
|
final List<? extends Schema> xmlSchemas, final EntityType entityType) {
|
||||||
|
|
||||||
final FullQualifiedName baseTypeName = entityType.getBaseType() == null
|
final FullQualifiedName baseTypeName = entityType.getBaseType() == null
|
||||||
? null
|
? null
|
||||||
: new EdmTypeInfo.Builder().setTypeExpression(entityType.getBaseType()).build().getFullQualifiedName();
|
: new EdmTypeInfo.Builder().setTypeExpression(entityType.getBaseType()).build().getFullQualifiedName();
|
||||||
|
@ -68,26 +72,36 @@ public class EdmEntityTypeImpl extends AbstractEdmEntityType {
|
||||||
final List<? extends Schema> xmlSchemas, final EntityType entityType) {
|
final List<? extends Schema> xmlSchemas, final EntityType entityType) {
|
||||||
|
|
||||||
super(edm, fqn, baseTypeName, entityType.isHasStream());
|
super(edm, fqn, baseTypeName, entityType.isHasStream());
|
||||||
this.helper = new EdmStructuredTypeHelperImpl(edm, xmlSchemas, entityType);
|
this.typeHelper = new EdmStructuredTypeHelperImpl(edm, getFullQualifiedName(), xmlSchemas, entityType);
|
||||||
|
if (entityType instanceof org.apache.olingo.client.api.edm.xml.v4.EntityType) {
|
||||||
|
this.annotationHelper = new EdmAnnotationHelperImpl(edm,
|
||||||
|
(org.apache.olingo.client.api.edm.xml.v4.EntityType) entityType);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Map<String, EdmProperty> getProperties() {
|
protected Map<String, EdmProperty> getProperties() {
|
||||||
return helper.getProperties();
|
return typeHelper.getProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Map<String, EdmNavigationProperty> getNavigationProperties() {
|
protected Map<String, EdmNavigationProperty> getNavigationProperties() {
|
||||||
return helper.getNavigationProperties();
|
return typeHelper.getNavigationProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpenType() {
|
public boolean isOpenType() {
|
||||||
return helper.isOpenType();
|
return typeHelper.isOpenType();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAbstract() {
|
public boolean isAbstract() {
|
||||||
return helper.isAbstract();
|
return typeHelper.isAbstract();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EdmAnnotation> getAnnotations() {
|
||||||
|
return annotationHelper.getAnnotations();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,12 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.olingo.client.core.edm;
|
package org.apache.olingo.client.core.edm;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import org.apache.olingo.client.api.edm.xml.EnumType;
|
import org.apache.olingo.client.api.edm.xml.EnumType;
|
||||||
import org.apache.olingo.client.api.edm.xml.Member;
|
import org.apache.olingo.client.api.edm.xml.Member;
|
||||||
import org.apache.olingo.commons.api.edm.Edm;
|
import org.apache.olingo.commons.api.edm.Edm;
|
||||||
|
@ -26,14 +32,6 @@ import org.apache.olingo.commons.api.edm.EdmMember;
|
||||||
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
|
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
|
||||||
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
||||||
import org.apache.olingo.commons.core.edm.AbstractEdmEnumType;
|
import org.apache.olingo.commons.core.edm.AbstractEdmEnumType;
|
||||||
import org.apache.olingo.commons.core.edm.EdmMemberImpl;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
import org.apache.olingo.commons.api.edm.EdmException;
|
import org.apache.olingo.commons.api.edm.EdmException;
|
||||||
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
|
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
|
||||||
|
@ -76,7 +74,7 @@ public class EdmEnumTypeImpl extends AbstractEdmEnumType implements EdmEnumType
|
||||||
final Map<String, EdmMember> _members = new LinkedHashMap<String, EdmMember>(xmlMembers.size());
|
final Map<String, EdmMember> _members = new LinkedHashMap<String, EdmMember>(xmlMembers.size());
|
||||||
for (Member xmlMember : xmlMembers) {
|
for (Member xmlMember : xmlMembers) {
|
||||||
_memberNames.add(xmlMember.getName());
|
_memberNames.add(xmlMember.getName());
|
||||||
_members.put(xmlMember.getName(), new EdmMemberImpl(edm, xmlMember.getName(), xmlMember.getValue()));
|
_members.put(xmlMember.getName(), new EdmMemberImpl(edm, fqn, xmlMember));
|
||||||
}
|
}
|
||||||
this.memberNames = Collections.unmodifiableList(_memberNames);
|
this.memberNames = Collections.unmodifiableList(_memberNames);
|
||||||
this.members = Collections.unmodifiableMap(_members);
|
this.members = Collections.unmodifiableMap(_members);
|
||||||
|
|
|
@ -23,15 +23,19 @@ import java.util.List;
|
||||||
|
|
||||||
import org.apache.olingo.client.api.edm.xml.v4.FunctionImport;
|
import org.apache.olingo.client.api.edm.xml.v4.FunctionImport;
|
||||||
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.EdmFunction;
|
import org.apache.olingo.commons.api.edm.EdmFunction;
|
||||||
import org.apache.olingo.commons.api.edm.EdmFunctionImport;
|
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.core.edm.EdmAnnotationHelper;
|
||||||
|
|
||||||
public class EdmFunctionImportImpl extends EdmOperationImportImpl implements EdmFunctionImport {
|
public class EdmFunctionImportImpl extends EdmOperationImportImpl implements EdmFunctionImport {
|
||||||
|
|
||||||
private final FunctionImport functionImport;
|
private final FunctionImport functionImport;
|
||||||
|
|
||||||
|
private final EdmAnnotationHelper helper;
|
||||||
|
|
||||||
private FullQualifiedName functionFQN;
|
private FullQualifiedName functionFQN;
|
||||||
|
|
||||||
public EdmFunctionImportImpl(final Edm edm, final EdmEntityContainer container, final String name,
|
public EdmFunctionImportImpl(final Edm edm, final EdmEntityContainer container, final String name,
|
||||||
|
@ -39,6 +43,12 @@ public class EdmFunctionImportImpl extends EdmOperationImportImpl implements Edm
|
||||||
|
|
||||||
super(edm, container, name, functionImport.getEntitySet());
|
super(edm, container, name, functionImport.getEntitySet());
|
||||||
this.functionImport = functionImport;
|
this.functionImport = functionImport;
|
||||||
|
this.helper = new EdmAnnotationHelperImpl(edm, functionImport);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TargetType getAnnotationsTargetType() {
|
||||||
|
return TargetType.FunctionImport;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -65,4 +75,9 @@ public class EdmFunctionImportImpl extends EdmOperationImportImpl implements Edm
|
||||||
return functionImport.isIncludeInServiceDocument();
|
return functionImport.isIncludeInServiceDocument();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EdmAnnotation> getAnnotations() {
|
||||||
|
return helper.getAnnotations();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
/*
|
||||||
|
* 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.client.core.edm;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.olingo.client.api.edm.xml.Member;
|
||||||
|
import org.apache.olingo.client.core.edm.xml.v4.MemberImpl;
|
||||||
|
import org.apache.olingo.commons.api.edm.Edm;
|
||||||
|
import org.apache.olingo.commons.api.edm.EdmAnnotation;
|
||||||
|
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
||||||
|
import org.apache.olingo.commons.core.edm.AbstractEdmMember;
|
||||||
|
import org.apache.olingo.commons.core.edm.EdmAnnotationHelper;
|
||||||
|
|
||||||
|
public class EdmMemberImpl extends AbstractEdmMember {
|
||||||
|
|
||||||
|
private EdmAnnotationHelper helper;
|
||||||
|
|
||||||
|
public EdmMemberImpl(final Edm edm, final FullQualifiedName enumFQN, final Member member) {
|
||||||
|
super(edm, enumFQN, member.getName(), member.getValue());
|
||||||
|
this.helper = member instanceof MemberImpl
|
||||||
|
? new EdmAnnotationHelperImpl(edm, (MemberImpl) member)
|
||||||
|
: null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EdmAnnotation> getAnnotations() {
|
||||||
|
return helper == null ? Collections.<EdmAnnotation>emptyList() : helper.getAnnotations();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -24,24 +24,34 @@ import java.util.List;
|
||||||
import org.apache.olingo.client.api.edm.xml.v4.NavigationProperty;
|
import org.apache.olingo.client.api.edm.xml.v4.NavigationProperty;
|
||||||
import org.apache.olingo.client.api.edm.xml.v4.ReferentialConstraint;
|
import org.apache.olingo.client.api.edm.xml.v4.ReferentialConstraint;
|
||||||
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.FullQualifiedName;
|
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
||||||
import org.apache.olingo.commons.core.edm.AbstractEdmNavigationProperty;
|
import org.apache.olingo.commons.core.edm.AbstractEdmNavigationProperty;
|
||||||
import org.apache.olingo.commons.core.edm.EdmReferentialConstraintImpl;
|
import org.apache.olingo.commons.core.edm.EdmAnnotationHelper;
|
||||||
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
|
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
|
||||||
|
|
||||||
public class EdmNavigationPropertyImpl extends AbstractEdmNavigationProperty {
|
public class EdmNavigationPropertyImpl extends AbstractEdmNavigationProperty {
|
||||||
|
|
||||||
|
private final FullQualifiedName structuredTypeName;
|
||||||
|
|
||||||
private final NavigationProperty navigationProperty;
|
private final NavigationProperty navigationProperty;
|
||||||
|
|
||||||
private final EdmTypeInfo edmTypeInfo;
|
private final EdmTypeInfo edmTypeInfo;
|
||||||
|
|
||||||
|
private final EdmAnnotationHelper helper;
|
||||||
|
|
||||||
private List<EdmReferentialConstraint> referentialConstraints;
|
private List<EdmReferentialConstraint> referentialConstraints;
|
||||||
|
|
||||||
public EdmNavigationPropertyImpl(final Edm edm, final NavigationProperty navigationProperty) {
|
public EdmNavigationPropertyImpl(
|
||||||
|
final Edm edm, final FullQualifiedName structuredTypeName, final NavigationProperty navigationProperty) {
|
||||||
|
|
||||||
super(edm, navigationProperty.getName());
|
super(edm, navigationProperty.getName());
|
||||||
|
|
||||||
|
this.structuredTypeName = structuredTypeName;
|
||||||
this.navigationProperty = navigationProperty;
|
this.navigationProperty = navigationProperty;
|
||||||
this.edmTypeInfo = new EdmTypeInfo.Builder().setTypeExpression(navigationProperty.getType()).build();
|
this.edmTypeInfo = new EdmTypeInfo.Builder().setTypeExpression(navigationProperty.getType()).build();
|
||||||
|
this.helper = new EdmAnnotationHelperImpl(edm, navigationProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -71,11 +81,9 @@ public class EdmNavigationPropertyImpl extends AbstractEdmNavigationProperty {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getReferencingPropertyName(final String referencedPropertyName) {
|
public String getReferencingPropertyName(final String referencedPropertyName) {
|
||||||
final List<? extends ReferentialConstraint> _referentialConstraints =
|
for (EdmReferentialConstraint constraint : getReferentialConstraints()) {
|
||||||
navigationProperty.getReferentialConstraints();
|
if (constraint.getReferencedPropertyName().equals(referencedPropertyName)) {
|
||||||
for (ReferentialConstraint constraint : _referentialConstraints) {
|
return constraint.getPropertyName();
|
||||||
if (constraint.getReferencedProperty().equals(referencedPropertyName)) {
|
|
||||||
return constraint.getProperty();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,12 +97,21 @@ public class EdmNavigationPropertyImpl extends AbstractEdmNavigationProperty {
|
||||||
referentialConstraints = new ArrayList<EdmReferentialConstraint>();
|
referentialConstraints = new ArrayList<EdmReferentialConstraint>();
|
||||||
if (providerConstraints != null) {
|
if (providerConstraints != null) {
|
||||||
for (ReferentialConstraint constraint : providerConstraints) {
|
for (ReferentialConstraint constraint : providerConstraints) {
|
||||||
referentialConstraints.add(
|
referentialConstraints.add(new EdmReferentialConstraintImpl(edm, constraint));
|
||||||
new EdmReferentialConstraintImpl(constraint.getProperty(), constraint.getReferencedProperty()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return referentialConstraints;
|
return referentialConstraints;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FullQualifiedName getAnnotationsTargetFQN() {
|
||||||
|
return structuredTypeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EdmAnnotation> getAnnotations() {
|
||||||
|
return helper.getAnnotations();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,20 +24,24 @@ import java.util.List;
|
||||||
import org.apache.olingo.client.api.edm.xml.CommonParameter;
|
import org.apache.olingo.client.api.edm.xml.CommonParameter;
|
||||||
import org.apache.olingo.client.api.edm.xml.v4.Action;
|
import org.apache.olingo.client.api.edm.xml.v4.Action;
|
||||||
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.EdmParameter;
|
import org.apache.olingo.commons.api.edm.EdmParameter;
|
||||||
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.core.edm.AbstractEdmOperation;
|
import org.apache.olingo.commons.core.edm.AbstractEdmOperation;
|
||||||
|
import org.apache.olingo.commons.core.edm.EdmAnnotationHelper;
|
||||||
|
|
||||||
public abstract class EdmOperationImpl extends AbstractEdmOperation {
|
public abstract class EdmOperationImpl extends AbstractEdmOperation {
|
||||||
|
|
||||||
protected final Action operation;
|
protected final Action operation;
|
||||||
|
|
||||||
|
protected final EdmAnnotationHelper helper;
|
||||||
|
|
||||||
protected static <T extends EdmOperationImpl> T getInstance(final T instance) {
|
protected static <T extends EdmOperationImpl> T getInstance(final T instance) {
|
||||||
final List<? extends CommonParameter> parameters = instance.operation.getParameters();
|
final List<? extends CommonParameter> parameters = instance.operation.getParameters();
|
||||||
final List<EdmParameter> _parameters = new ArrayList<EdmParameter>(parameters.size());
|
final List<EdmParameter> _parameters = new ArrayList<EdmParameter>(parameters.size());
|
||||||
for (CommonParameter parameter : parameters) {
|
for (CommonParameter parameter : parameters) {
|
||||||
_parameters.add(EdmParameterImpl.getInstance(instance.edm, parameter));
|
_parameters.add(new EdmParameterImpl(instance.edm, parameter));
|
||||||
}
|
}
|
||||||
instance.setParameters(_parameters);
|
instance.setParameters(_parameters);
|
||||||
|
|
||||||
|
@ -57,6 +61,7 @@ public abstract class EdmOperationImpl extends AbstractEdmOperation {
|
||||||
|
|
||||||
super(edm, name, kind);
|
super(edm, name, kind);
|
||||||
this.operation = operation;
|
this.operation = operation;
|
||||||
|
this.helper = new EdmAnnotationHelperImpl(edm, operation);
|
||||||
}
|
}
|
||||||
|
|
||||||
private EdmParameter getBindingParameter() {
|
private EdmParameter getBindingParameter() {
|
||||||
|
@ -87,4 +92,10 @@ public abstract class EdmOperationImpl extends AbstractEdmOperation {
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EdmAnnotation> getAnnotations() {
|
||||||
|
return helper.getAnnotations();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,10 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.olingo.client.core.edm;
|
package org.apache.olingo.client.core.edm;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
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.Target;
|
import org.apache.olingo.commons.api.edm.Target;
|
||||||
import org.apache.olingo.commons.core.edm.AbstractEdmOperationImport;
|
import org.apache.olingo.commons.core.edm.AbstractEdmOperationImport;
|
||||||
|
@ -31,4 +34,8 @@ public abstract class EdmOperationImportImpl extends AbstractEdmOperationImport
|
||||||
super(edm, container, name, entitySet == null ? null : new Target.Builder(entitySet, container).build());
|
super(edm, container, name, entitySet == null ? null : new Target.Builder(entitySet, container).build());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EdmAnnotation> getAnnotations() {
|
||||||
|
return Collections.<EdmAnnotation>emptyList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,32 +18,39 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.olingo.client.core.edm;
|
package org.apache.olingo.client.core.edm;
|
||||||
|
|
||||||
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
import org.apache.olingo.client.api.edm.xml.CommonParameter;
|
import org.apache.olingo.client.api.edm.xml.CommonParameter;
|
||||||
|
import org.apache.olingo.client.api.edm.xml.v4.Parameter;
|
||||||
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.EdmMapping;
|
import org.apache.olingo.commons.api.edm.EdmMapping;
|
||||||
|
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
||||||
|
import org.apache.olingo.commons.api.edm.geo.SRID;
|
||||||
import org.apache.olingo.commons.core.edm.AbstractEdmParameter;
|
import org.apache.olingo.commons.core.edm.AbstractEdmParameter;
|
||||||
|
import org.apache.olingo.commons.core.edm.EdmAnnotationHelper;
|
||||||
|
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
|
||||||
|
|
||||||
public class EdmParameterImpl extends AbstractEdmParameter {
|
public class EdmParameterImpl extends AbstractEdmParameter {
|
||||||
|
|
||||||
private final CommonParameter parameter;
|
private final CommonParameter parameter;
|
||||||
|
|
||||||
private final EdmTypeInfo parameterInfo;
|
private final EdmTypeInfo typeInfo;
|
||||||
|
|
||||||
public static EdmParameterImpl getInstance(final Edm edm, final CommonParameter parameter) {
|
private EdmAnnotationHelper helper;
|
||||||
final EdmTypeInfo paramTypeInfo = new EdmTypeInfo.Builder().setTypeExpression(parameter.getType()).build();
|
|
||||||
return new EdmParameterImpl(edm, parameter, paramTypeInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
private EdmParameterImpl(final Edm edm, final CommonParameter parameter, final EdmTypeInfo parameterInfo) {
|
public EdmParameterImpl(final Edm edm, final CommonParameter parameter) {
|
||||||
super(edm, parameter.getName(), parameterInfo.getFullQualifiedName());
|
super(edm, parameter.getName(), new FullQualifiedName(parameter.getType()));
|
||||||
this.parameter = parameter;
|
this.parameter = parameter;
|
||||||
this.parameterInfo = parameterInfo;
|
this.typeInfo = new EdmTypeInfo.Builder().setEdm(edm).setTypeExpression(parameter.getType()).build();
|
||||||
|
if (parameter instanceof Parameter) {
|
||||||
|
this.helper = new EdmAnnotationHelperImpl(edm, (Parameter) parameter);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isCollection() {
|
public boolean isCollection() {
|
||||||
return parameterInfo.isCollection();
|
return typeInfo.isCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -71,4 +78,16 @@ public class EdmParameterImpl extends AbstractEdmParameter {
|
||||||
return parameter.getScale();
|
return parameter.getScale();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SRID getSrid() {
|
||||||
|
return (parameter instanceof Parameter)
|
||||||
|
? ((Parameter) parameter).getSrid()
|
||||||
|
: null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EdmAnnotation> getAnnotations() {
|
||||||
|
return helper == null ? Collections.<EdmAnnotation>emptyList() : helper.getAnnotations();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,34 +18,44 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.olingo.client.core.edm;
|
package org.apache.olingo.client.core.edm;
|
||||||
|
|
||||||
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
import org.apache.olingo.client.api.edm.xml.CommonProperty;
|
import org.apache.olingo.client.api.edm.xml.CommonProperty;
|
||||||
|
import org.apache.olingo.client.api.edm.xml.v4.Property;
|
||||||
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.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.FullQualifiedName;
|
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
||||||
|
import org.apache.olingo.commons.api.edm.geo.SRID;
|
||||||
import org.apache.olingo.commons.core.edm.AbstractEdmProperty;
|
import org.apache.olingo.commons.core.edm.AbstractEdmProperty;
|
||||||
|
import org.apache.olingo.commons.core.edm.EdmAnnotationHelper;
|
||||||
|
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
|
||||||
|
|
||||||
public class EdmPropertyImpl extends AbstractEdmProperty implements EdmProperty {
|
public class EdmPropertyImpl extends AbstractEdmProperty implements EdmProperty {
|
||||||
|
|
||||||
|
private final FullQualifiedName structuredTypeName;
|
||||||
|
|
||||||
private final CommonProperty property;
|
private final CommonProperty property;
|
||||||
|
|
||||||
private final EdmTypeInfo edmTypeInfo;
|
private final EdmTypeInfo typeInfo;
|
||||||
|
|
||||||
public EdmPropertyImpl(final Edm edm, final CommonProperty property) {
|
private EdmAnnotationHelper helper;
|
||||||
|
|
||||||
|
public EdmPropertyImpl(final Edm edm, final FullQualifiedName structuredTypeName, final CommonProperty property) {
|
||||||
super(edm, property.getName());
|
super(edm, property.getName());
|
||||||
|
|
||||||
|
this.structuredTypeName = structuredTypeName;
|
||||||
this.property = property;
|
this.property = property;
|
||||||
this.edmTypeInfo = new EdmTypeInfo.Builder().setTypeExpression(property.getType()).build();
|
this.typeInfo = new EdmTypeInfo.Builder().setEdm(edm).setTypeExpression(property.getType()).build();
|
||||||
|
if (property instanceof Property) {
|
||||||
|
this.helper = new EdmAnnotationHelperImpl(edm, (Property) property);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected FullQualifiedName getTypeFQN() {
|
protected EdmTypeInfo getTypeInfo() {
|
||||||
return edmTypeInfo.getFullQualifiedName();
|
return typeInfo;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isCollection() {
|
|
||||||
return edmTypeInfo.isCollection();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -88,4 +98,21 @@ public class EdmPropertyImpl extends AbstractEdmProperty implements EdmProperty
|
||||||
return property.getDefaultValue();
|
return property.getDefaultValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SRID getSrid() {
|
||||||
|
return (property instanceof Property)
|
||||||
|
? ((Property) property).getSrid()
|
||||||
|
: null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FullQualifiedName getAnnotationsTargetFQN() {
|
||||||
|
return structuredTypeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EdmAnnotation> getAnnotations() {
|
||||||
|
return helper == null ? Collections.<EdmAnnotation>emptyList() : helper.getAnnotations();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
/*
|
||||||
|
* 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.client.core.edm;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.olingo.client.api.edm.xml.v4.ReferentialConstraint;
|
||||||
|
import org.apache.olingo.commons.api.edm.Edm;
|
||||||
|
import org.apache.olingo.commons.api.edm.EdmAnnotation;
|
||||||
|
import org.apache.olingo.commons.core.edm.AbstractEdmReferentialConstraint;
|
||||||
|
import org.apache.olingo.commons.core.edm.EdmAnnotationHelper;
|
||||||
|
|
||||||
|
public class EdmReferentialConstraintImpl extends AbstractEdmReferentialConstraint {
|
||||||
|
|
||||||
|
private final EdmAnnotationHelper helper;
|
||||||
|
|
||||||
|
public EdmReferentialConstraintImpl(final Edm edm, final ReferentialConstraint constraint) {
|
||||||
|
super(constraint.getProperty(), constraint.getReferencedProperty());
|
||||||
|
this.helper = new EdmAnnotationHelperImpl(edm, constraint);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EdmAnnotation> getAnnotations() {
|
||||||
|
return helper.getAnnotations();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -18,16 +18,17 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.olingo.client.core.edm;
|
package org.apache.olingo.client.core.edm;
|
||||||
|
|
||||||
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
|
|
||||||
import org.apache.olingo.client.api.edm.xml.v4.ReturnType;
|
import org.apache.olingo.client.api.edm.xml.v4.ReturnType;
|
||||||
import org.apache.olingo.commons.api.edm.Edm;
|
import org.apache.olingo.commons.api.edm.Edm;
|
||||||
|
import org.apache.olingo.commons.api.edm.geo.SRID;
|
||||||
import org.apache.olingo.commons.core.edm.AbstractEdmReturnType;
|
import org.apache.olingo.commons.core.edm.AbstractEdmReturnType;
|
||||||
|
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
|
||||||
|
|
||||||
public class EdmReturnTypeImpl extends AbstractEdmReturnType {
|
public class EdmReturnTypeImpl extends AbstractEdmReturnType {
|
||||||
|
|
||||||
private final ReturnType returnType;
|
private final ReturnType returnType;
|
||||||
|
|
||||||
private final EdmTypeInfo returnTypeInfo;
|
private final boolean isCollection;
|
||||||
|
|
||||||
public static EdmReturnTypeImpl getInstance(final Edm edm, final ReturnType returnType) {
|
public static EdmReturnTypeImpl getInstance(final Edm edm, final ReturnType returnType) {
|
||||||
final EdmTypeInfo returnTypeInfo = new EdmTypeInfo.Builder().setTypeExpression(returnType.getType()).build();
|
final EdmTypeInfo returnTypeInfo = new EdmTypeInfo.Builder().setTypeExpression(returnType.getType()).build();
|
||||||
|
@ -37,7 +38,12 @@ public class EdmReturnTypeImpl extends AbstractEdmReturnType {
|
||||||
private EdmReturnTypeImpl(final Edm edm, final ReturnType returnType, final EdmTypeInfo returnTypeInfo) {
|
private EdmReturnTypeImpl(final Edm edm, final ReturnType returnType, final EdmTypeInfo returnTypeInfo) {
|
||||||
super(edm, returnTypeInfo.getFullQualifiedName());
|
super(edm, returnTypeInfo.getFullQualifiedName());
|
||||||
this.returnType = returnType;
|
this.returnType = returnType;
|
||||||
this.returnTypeInfo = returnTypeInfo;
|
this.isCollection = returnTypeInfo.isCollection();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCollection() {
|
||||||
|
return isCollection;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -61,8 +67,10 @@ public class EdmReturnTypeImpl extends AbstractEdmReturnType {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isCollection() {
|
public SRID getSrid() {
|
||||||
return returnTypeInfo.isCollection();
|
return (returnType instanceof ReturnType)
|
||||||
|
? ((ReturnType) returnType).getSrid()
|
||||||
|
: null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,6 @@ import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.olingo.client.api.edm.xml.ComplexType;
|
import org.apache.olingo.client.api.edm.xml.ComplexType;
|
||||||
import org.apache.olingo.client.api.edm.xml.EntityContainer;
|
import org.apache.olingo.client.api.edm.xml.EntityContainer;
|
||||||
import org.apache.olingo.client.api.edm.xml.EntityType;
|
import org.apache.olingo.client.api.edm.xml.EntityType;
|
||||||
|
@ -30,16 +29,22 @@ import org.apache.olingo.client.api.edm.xml.EnumType;
|
||||||
import org.apache.olingo.client.api.edm.xml.Schema;
|
import org.apache.olingo.client.api.edm.xml.Schema;
|
||||||
import org.apache.olingo.client.api.edm.xml.v3.FunctionImport;
|
import org.apache.olingo.client.api.edm.xml.v3.FunctionImport;
|
||||||
import org.apache.olingo.client.api.edm.xml.v4.Action;
|
import org.apache.olingo.client.api.edm.xml.v4.Action;
|
||||||
|
import org.apache.olingo.client.api.edm.xml.v4.Annotation;
|
||||||
|
import org.apache.olingo.client.api.edm.xml.v4.Annotations;
|
||||||
import org.apache.olingo.client.api.edm.xml.v4.Function;
|
import org.apache.olingo.client.api.edm.xml.v4.Function;
|
||||||
|
import org.apache.olingo.client.api.edm.xml.v4.Term;
|
||||||
import org.apache.olingo.client.api.edm.xml.v4.TypeDefinition;
|
import org.apache.olingo.client.api.edm.xml.v4.TypeDefinition;
|
||||||
import org.apache.olingo.client.core.edm.v3.EdmFunctionProxy;
|
import org.apache.olingo.client.core.edm.v3.EdmFunctionProxy;
|
||||||
import org.apache.olingo.commons.api.edm.Edm;
|
import org.apache.olingo.commons.api.edm.Edm;
|
||||||
import org.apache.olingo.commons.api.edm.EdmAction;
|
import org.apache.olingo.commons.api.edm.EdmAction;
|
||||||
|
import org.apache.olingo.commons.api.edm.EdmAnnotation;
|
||||||
|
import org.apache.olingo.commons.api.edm.EdmAnnotations;
|
||||||
import org.apache.olingo.commons.api.edm.EdmComplexType;
|
import org.apache.olingo.commons.api.edm.EdmComplexType;
|
||||||
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.EdmEnumType;
|
import org.apache.olingo.commons.api.edm.EdmEnumType;
|
||||||
import org.apache.olingo.commons.api.edm.EdmFunction;
|
import org.apache.olingo.commons.api.edm.EdmFunction;
|
||||||
|
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.ODataServiceVersion;
|
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
|
||||||
|
@ -92,6 +97,7 @@ public class EdmSchemaImpl extends AbstractEdmSchema {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EdmEntityContainer getEntityContainer(final FullQualifiedName name) {
|
public EdmEntityContainer getEntityContainer(final FullQualifiedName name) {
|
||||||
|
getEntityContainers();
|
||||||
return entityContainerByName.get(name);
|
return entityContainerByName.get(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,4 +216,48 @@ public class EdmSchemaImpl extends AbstractEdmSchema {
|
||||||
}
|
}
|
||||||
return functions;
|
return functions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<EdmTerm> createTerms() {
|
||||||
|
final List<EdmTerm> terms = new ArrayList<EdmTerm>();
|
||||||
|
if (schema instanceof org.apache.olingo.client.api.edm.xml.v4.Schema) {
|
||||||
|
final List<Term> providerTerms = ((org.apache.olingo.client.api.edm.xml.v4.Schema) schema).getTerms();
|
||||||
|
if (providerTerms != null) {
|
||||||
|
for (Term term : providerTerms) {
|
||||||
|
terms.add(new EdmTermImpl(edm, term));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return terms;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<EdmAnnotations> createAnnotationGroups() {
|
||||||
|
final List<EdmAnnotations> annotationGroups = new ArrayList<EdmAnnotations>();
|
||||||
|
if (schema instanceof org.apache.olingo.client.api.edm.xml.v4.Schema) {
|
||||||
|
final List<Annotations> providerAnnotations =
|
||||||
|
((org.apache.olingo.client.api.edm.xml.v4.Schema) schema).getAnnotationGroups();
|
||||||
|
if (providerAnnotations != null) {
|
||||||
|
for (Annotations annotationGroup : providerAnnotations) {
|
||||||
|
annotationGroups.add(new EdmAnnotationsImpl(edm, this, annotationGroup));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return annotationGroups;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<EdmAnnotation> createAnnotations() {
|
||||||
|
final List<EdmAnnotation> annotations = new ArrayList<EdmAnnotation>();
|
||||||
|
if (schema instanceof org.apache.olingo.client.api.edm.xml.v4.Schema) {
|
||||||
|
final List<Annotation> providerAnnotations =
|
||||||
|
((org.apache.olingo.client.api.edm.xml.v4.Schema) schema).getAnnotations();
|
||||||
|
if (providerAnnotations != null) {
|
||||||
|
for (Annotation annotation : providerAnnotations) {
|
||||||
|
annotations.add(new EdmAnnotationImpl(edm, annotation));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return annotations;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,4 +32,9 @@ public class EdmSingletonImpl extends EdmBindingTargetImpl implements EdmSinglet
|
||||||
super(edm, container, name, type, singleton);
|
super(edm, container, name, type, singleton);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TargetType getAnnotationsTargetType() {
|
||||||
|
return TargetType.Singleton;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,12 +31,15 @@ import org.apache.olingo.client.core.edm.v3.EdmNavigationPropertyProxy;
|
||||||
import org.apache.olingo.commons.api.edm.Edm;
|
import org.apache.olingo.commons.api.edm.Edm;
|
||||||
import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
|
import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
|
||||||
import org.apache.olingo.commons.api.edm.EdmProperty;
|
import org.apache.olingo.commons.api.edm.EdmProperty;
|
||||||
|
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
||||||
import org.apache.olingo.commons.core.edm.EdmStructuredTypeHelper;
|
import org.apache.olingo.commons.core.edm.EdmStructuredTypeHelper;
|
||||||
|
|
||||||
public class EdmStructuredTypeHelperImpl implements EdmStructuredTypeHelper {
|
public class EdmStructuredTypeHelperImpl implements EdmStructuredTypeHelper {
|
||||||
|
|
||||||
private final Edm edm;
|
private final Edm edm;
|
||||||
|
|
||||||
|
private final FullQualifiedName structuredTypeName;
|
||||||
|
|
||||||
private final ComplexType complexType;
|
private final ComplexType complexType;
|
||||||
|
|
||||||
private final List<? extends Schema> xmlSchemas;
|
private final List<? extends Schema> xmlSchemas;
|
||||||
|
@ -45,10 +48,11 @@ public class EdmStructuredTypeHelperImpl implements EdmStructuredTypeHelper {
|
||||||
|
|
||||||
private Map<String, EdmNavigationProperty> navigationProperties;
|
private Map<String, EdmNavigationProperty> navigationProperties;
|
||||||
|
|
||||||
public EdmStructuredTypeHelperImpl(
|
public EdmStructuredTypeHelperImpl(final Edm edm, final FullQualifiedName structuredTypeName,
|
||||||
final Edm edm, final List<? extends Schema> xmlSchemas, final ComplexType complexType) {
|
final List<? extends Schema> xmlSchemas, final ComplexType complexType) {
|
||||||
|
|
||||||
this.edm = edm;
|
this.edm = edm;
|
||||||
|
this.structuredTypeName = structuredTypeName;
|
||||||
this.complexType = complexType;
|
this.complexType = complexType;
|
||||||
this.xmlSchemas = xmlSchemas;
|
this.xmlSchemas = xmlSchemas;
|
||||||
}
|
}
|
||||||
|
@ -58,7 +62,7 @@ public class EdmStructuredTypeHelperImpl implements EdmStructuredTypeHelper {
|
||||||
if (properties == null) {
|
if (properties == null) {
|
||||||
properties = new LinkedHashMap<String, EdmProperty>();
|
properties = new LinkedHashMap<String, EdmProperty>();
|
||||||
for (CommonProperty property : complexType.getProperties()) {
|
for (CommonProperty property : complexType.getProperties()) {
|
||||||
properties.put(property.getName(), new EdmPropertyImpl(edm, property));
|
properties.put(property.getName(), new EdmPropertyImpl(edm, structuredTypeName, property));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return properties;
|
return properties;
|
||||||
|
@ -71,10 +75,12 @@ public class EdmStructuredTypeHelperImpl implements EdmStructuredTypeHelper {
|
||||||
for (CommonNavigationProperty navigationProperty : complexType.getNavigationProperties()) {
|
for (CommonNavigationProperty navigationProperty : complexType.getNavigationProperties()) {
|
||||||
if (navigationProperty instanceof org.apache.olingo.client.api.edm.xml.v4.NavigationProperty) {
|
if (navigationProperty instanceof org.apache.olingo.client.api.edm.xml.v4.NavigationProperty) {
|
||||||
navigationProperties.put(navigationProperty.getName(), new EdmNavigationPropertyImpl(
|
navigationProperties.put(navigationProperty.getName(), new EdmNavigationPropertyImpl(
|
||||||
edm, (org.apache.olingo.client.api.edm.xml.v4.NavigationProperty) navigationProperty));
|
edm, structuredTypeName,
|
||||||
|
(org.apache.olingo.client.api.edm.xml.v4.NavigationProperty) navigationProperty));
|
||||||
} else if (navigationProperty instanceof org.apache.olingo.client.api.edm.xml.v3.NavigationProperty) {
|
} else if (navigationProperty instanceof org.apache.olingo.client.api.edm.xml.v3.NavigationProperty) {
|
||||||
navigationProperties.put(navigationProperty.getName(), new EdmNavigationPropertyProxy(
|
navigationProperties.put(navigationProperty.getName(), new EdmNavigationPropertyProxy(
|
||||||
edm, xmlSchemas, (org.apache.olingo.client.api.edm.xml.v3.NavigationProperty) navigationProperty));
|
edm, xmlSchemas,
|
||||||
|
(org.apache.olingo.client.api.edm.xml.v3.NavigationProperty) navigationProperty));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,161 @@
|
||||||
|
/*
|
||||||
|
* 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.client.core.edm;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.commons.lang3.ClassUtils;
|
||||||
|
import org.apache.olingo.client.api.edm.xml.v4.Term;
|
||||||
|
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.EdmTerm;
|
||||||
|
import org.apache.olingo.commons.api.edm.EdmType;
|
||||||
|
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
||||||
|
import org.apache.olingo.commons.api.edm.geo.SRID;
|
||||||
|
import org.apache.olingo.commons.core.edm.EdmAnnotationHelper;
|
||||||
|
import org.apache.olingo.commons.core.edm.EdmNamedImpl;
|
||||||
|
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
|
||||||
|
import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
public class EdmTermImpl extends EdmNamedImpl implements EdmTerm {
|
||||||
|
|
||||||
|
private static final Logger LOG = LoggerFactory.getLogger(EdmTermImpl.class);
|
||||||
|
|
||||||
|
private final Term term;
|
||||||
|
|
||||||
|
private final EdmTypeInfo typeInfo;
|
||||||
|
|
||||||
|
private final EdmAnnotationHelper helper;
|
||||||
|
|
||||||
|
private EdmType termType;
|
||||||
|
|
||||||
|
private EdmTerm baseTerm;
|
||||||
|
|
||||||
|
private List<Class<?>> appliesTo;
|
||||||
|
|
||||||
|
public EdmTermImpl(final Edm edm, final Term term) {
|
||||||
|
super(edm, term.getName());
|
||||||
|
|
||||||
|
this.term = term;
|
||||||
|
this.typeInfo = new EdmTypeInfo.Builder().setEdm(edm).setTypeExpression(term.getType()).build();
|
||||||
|
this.helper = new EdmAnnotationHelperImpl(edm, term);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FullQualifiedName getFullQualifiedName() {
|
||||||
|
return typeInfo.getFullQualifiedName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EdmType getType() {
|
||||||
|
if (termType == null) {
|
||||||
|
termType = typeInfo.isPrimitiveType()
|
||||||
|
? EdmPrimitiveTypeFactory.getInstance(typeInfo.getPrimitiveTypeKind())
|
||||||
|
: typeInfo.isTypeDefinition()
|
||||||
|
? typeInfo.getTypeDefinition()
|
||||||
|
: typeInfo.isEnumType()
|
||||||
|
? typeInfo.getEnumType()
|
||||||
|
: typeInfo.isComplexType()
|
||||||
|
? typeInfo.getComplexType()
|
||||||
|
: null;
|
||||||
|
if (termType == null) {
|
||||||
|
throw new EdmException("Cannot find type with name: " + typeInfo.getFullQualifiedName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return termType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EdmTerm getBaseTerm() {
|
||||||
|
if (baseTerm == null && term.getBaseTerm() != null) {
|
||||||
|
baseTerm = edm.getTerm(new FullQualifiedName(term.getBaseTerm()));
|
||||||
|
}
|
||||||
|
return baseTerm;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Class<?>> getAppliesTo() {
|
||||||
|
if (appliesTo == null) {
|
||||||
|
appliesTo = new ArrayList<Class<?>>();
|
||||||
|
for (String element : term.getAppliesTo()) {
|
||||||
|
try {
|
||||||
|
appliesTo.add(ClassUtils.getClass(EdmTerm.class.getPackage().getName() + ".Edm" + element));
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
LOG.error("Could not load Edm class for {}", element, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return appliesTo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean isNullable() {
|
||||||
|
return term.isNullable();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer getMaxLength() {
|
||||||
|
return term.getMaxLength();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer getPrecision() {
|
||||||
|
return term.getPrecision();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer getScale() {
|
||||||
|
return term.getScale();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SRID getSrid() {
|
||||||
|
return term.getSrid();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDefaultValue() {
|
||||||
|
return term.getDefaultValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TargetType getAnnotationsTargetType() {
|
||||||
|
return TargetType.Term;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FullQualifiedName getAnnotationsTargetFQN() {
|
||||||
|
return typeInfo.getFullQualifiedName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAnnotationsTargetPath() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EdmAnnotation> getAnnotations() {
|
||||||
|
return helper.getAnnotations();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -18,22 +18,28 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.olingo.client.core.edm;
|
package org.apache.olingo.client.core.edm;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import org.apache.olingo.client.api.edm.xml.v4.TypeDefinition;
|
import org.apache.olingo.client.api.edm.xml.v4.TypeDefinition;
|
||||||
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.EdmPrimitiveTypeKind;
|
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
|
||||||
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.ODataServiceVersion;
|
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
|
||||||
|
import org.apache.olingo.commons.api.edm.geo.SRID;
|
||||||
import org.apache.olingo.commons.core.edm.AbstractEdmTypeDefinition;
|
import org.apache.olingo.commons.core.edm.AbstractEdmTypeDefinition;
|
||||||
|
import org.apache.olingo.commons.core.edm.EdmAnnotationHelper;
|
||||||
import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
|
import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
|
||||||
|
|
||||||
public class EdmTypeDefinitionImpl extends AbstractEdmTypeDefinition implements EdmTypeDefinition {
|
public class EdmTypeDefinitionImpl extends AbstractEdmTypeDefinition implements EdmTypeDefinition {
|
||||||
|
|
||||||
private TypeDefinition typeDefinition;
|
private final TypeDefinition typeDefinition;
|
||||||
|
|
||||||
private EdmPrimitiveType edmPrimitiveTypeInstance;
|
private final EdmPrimitiveType edmPrimitiveTypeInstance;
|
||||||
|
|
||||||
|
private final EdmAnnotationHelper helper;
|
||||||
|
|
||||||
public EdmTypeDefinitionImpl(final ODataServiceVersion version, final Edm edm,
|
public EdmTypeDefinitionImpl(final ODataServiceVersion version, final Edm edm,
|
||||||
final FullQualifiedName typeDefinitionName, final TypeDefinition typeDefinition) {
|
final FullQualifiedName typeDefinitionName, final TypeDefinition typeDefinition) {
|
||||||
|
@ -46,6 +52,7 @@ public class EdmTypeDefinitionImpl extends AbstractEdmTypeDefinition implements
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
throw new EdmException("Invalid underlying type: " + typeDefinition.getUnderlyingType(), e);
|
throw new EdmException("Invalid underlying type: " + typeDefinition.getUnderlyingType(), e);
|
||||||
}
|
}
|
||||||
|
this.helper = new EdmAnnotationHelperImpl(edm, typeDefinition);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -68,8 +75,19 @@ public class EdmTypeDefinitionImpl extends AbstractEdmTypeDefinition implements
|
||||||
return typeDefinition.getScale();
|
return typeDefinition.getScale();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SRID getSrid() {
|
||||||
|
return typeDefinition.getSrid();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean isUnicode() {
|
public Boolean isUnicode() {
|
||||||
return typeDefinition.isUnicode();
|
return typeDefinition.isUnicode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EdmAnnotation> getAnnotations() {
|
||||||
|
return helper.getAnnotations();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,4 +53,9 @@ public class EdmActionImportProxy extends EdmOperationImportImpl implements EdmA
|
||||||
return edm.getUnboundAction(getActionFQN());
|
return edm.getUnboundAction(getActionFQN());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TargetType getAnnotationsTargetType() {
|
||||||
|
return TargetType.ActionImport;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ import org.apache.olingo.client.api.edm.xml.v3.AssociationSet;
|
||||||
import org.apache.olingo.client.core.edm.xml.v3.EntityContainerImpl;
|
import org.apache.olingo.client.core.edm.xml.v3.EntityContainerImpl;
|
||||||
import org.apache.olingo.client.core.edm.xml.v3.SchemaImpl;
|
import org.apache.olingo.client.core.edm.xml.v3.SchemaImpl;
|
||||||
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.EdmEntitySet;
|
import org.apache.olingo.commons.api.edm.EdmEntitySet;
|
||||||
|
@ -113,4 +114,14 @@ public class EdmEntitySetProxy extends AbstractEdmBindingTarget implements EdmEn
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TargetType getAnnotationsTargetType() {
|
||||||
|
return TargetType.EntitySet;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EdmAnnotation> getAnnotations() {
|
||||||
|
return Collections.<EdmAnnotation>emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,4 +65,9 @@ public class EdmFunctionImportProxy extends EdmOperationImportImpl implements Ed
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TargetType getAnnotationsTargetType() {
|
||||||
|
return TargetType.FunctionImport;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,4 +40,5 @@ public class EdmFunctionProxy extends EdmOperationProxy implements EdmFunction {
|
||||||
public boolean isComposable() {
|
public boolean isComposable() {
|
||||||
return functionImport.isComposable();
|
return functionImport.isComposable();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,20 +19,23 @@
|
||||||
package org.apache.olingo.client.core.edm.v3;
|
package org.apache.olingo.client.core.edm.v3;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.olingo.client.api.edm.xml.Schema;
|
import org.apache.olingo.client.api.edm.xml.Schema;
|
||||||
import org.apache.olingo.client.api.edm.xml.v3.Association;
|
import org.apache.olingo.client.api.edm.xml.v3.Association;
|
||||||
import org.apache.olingo.client.api.edm.xml.v3.AssociationEnd;
|
import org.apache.olingo.client.api.edm.xml.v3.AssociationEnd;
|
||||||
import org.apache.olingo.client.api.edm.xml.v3.NavigationProperty;
|
import org.apache.olingo.client.api.edm.xml.v3.NavigationProperty;
|
||||||
import org.apache.olingo.client.api.edm.xml.v3.ReferentialConstraint;
|
import org.apache.olingo.client.api.edm.xml.v3.ReferentialConstraint;
|
||||||
|
import org.apache.olingo.client.core.edm.EdmReferentialConstraintImpl;
|
||||||
import org.apache.olingo.client.core.edm.xml.v3.SchemaImpl;
|
import org.apache.olingo.client.core.edm.xml.v3.SchemaImpl;
|
||||||
|
import org.apache.olingo.client.core.edm.xml.v4.ReferentialConstraintImpl;
|
||||||
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.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.FullQualifiedName;
|
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
||||||
import org.apache.olingo.commons.core.edm.AbstractEdmNavigationProperty;
|
import org.apache.olingo.commons.core.edm.AbstractEdmNavigationProperty;
|
||||||
import org.apache.olingo.commons.core.edm.EdmReferentialConstraintImpl;
|
|
||||||
|
|
||||||
public class EdmNavigationPropertyProxy extends AbstractEdmNavigationProperty {
|
public class EdmNavigationPropertyProxy extends AbstractEdmNavigationProperty {
|
||||||
|
|
||||||
|
@ -120,7 +123,7 @@ public class EdmNavigationPropertyProxy extends AbstractEdmNavigationProperty {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EdmNavigationProperty getPartner() {
|
public EdmNavigationProperty getPartner() {
|
||||||
return partner == null ? this: partner;
|
return partner == null ? this : partner;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -156,13 +159,24 @@ public class EdmNavigationPropertyProxy extends AbstractEdmNavigationProperty {
|
||||||
referentialConstraints = new ArrayList<EdmReferentialConstraint>();
|
referentialConstraints = new ArrayList<EdmReferentialConstraint>();
|
||||||
if (constraint != null) {
|
if (constraint != null) {
|
||||||
for (int i = 0; i < constraint.getPrincipal().getPropertyRefs().size(); i++) {
|
for (int i = 0; i < constraint.getPrincipal().getPropertyRefs().size(); i++) {
|
||||||
referentialConstraints.add(new EdmReferentialConstraintImpl(
|
final ReferentialConstraintImpl referentialConstraint = new ReferentialConstraintImpl();
|
||||||
constraint.getPrincipal().getPropertyRefs().get(i).getName(),
|
referentialConstraint.setProperty(constraint.getPrincipal().getPropertyRefs().get(i).getName());
|
||||||
constraint.getDependent().getPropertyRefs().get(i).getName()));
|
referentialConstraint.setReferencedProperty(constraint.getDependent().getPropertyRefs().get(i).getName());
|
||||||
|
referentialConstraints.add(new EdmReferentialConstraintImpl(edm, referentialConstraint));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return referentialConstraints;
|
return referentialConstraints;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FullQualifiedName getAnnotationsTargetFQN() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EdmAnnotation> getAnnotations() {
|
||||||
|
return Collections.<EdmAnnotation>emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,9 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.olingo.client.core.edm.v3;
|
package org.apache.olingo.client.core.edm.v3;
|
||||||
|
|
||||||
|
import org.apache.olingo.client.core.edm.xml.v3.ReturnTypeProxy;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.olingo.client.api.edm.xml.CommonParameter;
|
import org.apache.olingo.client.api.edm.xml.CommonParameter;
|
||||||
|
@ -27,6 +29,7 @@ import org.apache.olingo.client.api.edm.xml.v3.Parameter;
|
||||||
import org.apache.olingo.client.core.edm.EdmParameterImpl;
|
import org.apache.olingo.client.core.edm.EdmParameterImpl;
|
||||||
import org.apache.olingo.client.core.edm.EdmReturnTypeImpl;
|
import org.apache.olingo.client.core.edm.EdmReturnTypeImpl;
|
||||||
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.EdmParameter;
|
import org.apache.olingo.commons.api.edm.EdmParameter;
|
||||||
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;
|
||||||
|
@ -40,7 +43,7 @@ public class EdmOperationProxy extends AbstractEdmOperation {
|
||||||
final List<Parameter> parameters = instance.functionImport.getParameters();
|
final List<Parameter> parameters = instance.functionImport.getParameters();
|
||||||
final List<EdmParameter> _parameters = new ArrayList<EdmParameter>(parameters.size());
|
final List<EdmParameter> _parameters = new ArrayList<EdmParameter>(parameters.size());
|
||||||
for (CommonParameter parameter : parameters) {
|
for (CommonParameter parameter : parameters) {
|
||||||
_parameters.add(EdmParameterImpl.getInstance(instance.edm, parameter));
|
_parameters.add(new EdmParameterImpl(instance.edm, parameter));
|
||||||
}
|
}
|
||||||
instance.setParameters(_parameters);
|
instance.setParameters(_parameters);
|
||||||
|
|
||||||
|
@ -74,4 +77,9 @@ public class EdmOperationProxy extends AbstractEdmOperation {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EdmAnnotation> getAnnotations() {
|
||||||
|
return Collections.<EdmAnnotation>emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,8 +43,8 @@ public class EdmServiceMetadataImpl extends AbstractEdmServiceMetadataImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDataServiceVersion() {
|
public ODataServiceVersion getDataServiceVersion() {
|
||||||
return SERVICE_VERSION.toString();
|
return SERVICE_VERSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -48,8 +48,8 @@ public class EdmServiceMetadataImpl extends AbstractEdmServiceMetadataImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDataServiceVersion() {
|
public ODataServiceVersion getDataServiceVersion() {
|
||||||
return SERVICE_VERSION.toString();
|
return SERVICE_VERSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -0,0 +1,80 @@
|
||||||
|
/*
|
||||||
|
* 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.client.core.edm.v4.annotation;
|
||||||
|
|
||||||
|
import org.apache.olingo.client.api.edm.xml.v4.annotation.Cast;
|
||||||
|
import org.apache.olingo.commons.api.edm.Edm;
|
||||||
|
import org.apache.olingo.commons.api.edm.EdmType;
|
||||||
|
import org.apache.olingo.commons.api.edm.annotation.EdmCast;
|
||||||
|
import org.apache.olingo.commons.api.edm.annotation.EdmDynamicAnnotationExpression;
|
||||||
|
import org.apache.olingo.commons.api.edm.geo.SRID;
|
||||||
|
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
|
||||||
|
import org.apache.olingo.commons.core.edm.annotation.AbstractEdmAnnotatableDynamicAnnotationExpression;
|
||||||
|
|
||||||
|
public class EdmCastImpl extends AbstractEdmAnnotatableDynamicAnnotationExpression implements EdmCast {
|
||||||
|
|
||||||
|
private final Edm edm;
|
||||||
|
|
||||||
|
private final Cast cast;
|
||||||
|
|
||||||
|
private final EdmDynamicAnnotationExpression value;
|
||||||
|
|
||||||
|
private EdmType type;
|
||||||
|
|
||||||
|
public EdmCastImpl(final Edm edm, final Cast cast, final EdmDynamicAnnotationExpression value) {
|
||||||
|
this.edm = edm;
|
||||||
|
this.cast = cast;
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer getMaxLength() {
|
||||||
|
return cast.getMaxLength();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer getPrecision() {
|
||||||
|
return cast.getPrecision();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer getScale() {
|
||||||
|
return cast.getScale();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SRID getSrid() {
|
||||||
|
return cast.getSrid();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EdmType getType() {
|
||||||
|
if (type == null) {
|
||||||
|
final EdmTypeInfo typeInfo = new EdmTypeInfo.Builder().setEdm(edm).setTypeExpression(cast.getType()).build();
|
||||||
|
type = typeInfo.getType();
|
||||||
|
}
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EdmDynamicAnnotationExpression getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,137 @@
|
||||||
|
/*
|
||||||
|
* 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.client.core.edm.v4.annotation;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.olingo.client.api.edm.xml.v4.annotation.ConstantAnnotationExpression;
|
||||||
|
import org.apache.olingo.commons.api.domain.v4.ODataEnumValue;
|
||||||
|
import org.apache.olingo.commons.api.domain.v4.ODataValue;
|
||||||
|
import org.apache.olingo.commons.api.edm.Edm;
|
||||||
|
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
|
||||||
|
import org.apache.olingo.commons.api.edm.annotation.EdmConstantAnnotationExpression;
|
||||||
|
import org.apache.olingo.commons.api.edm.annotation.EdmDynamicAnnotationExpression;
|
||||||
|
import org.apache.olingo.commons.core.domain.v4.ODataCollectionValueImpl;
|
||||||
|
import org.apache.olingo.commons.core.domain.v4.ODataEnumValueImpl;
|
||||||
|
import org.apache.olingo.commons.core.domain.v4.ODataPrimitiveValueImpl;
|
||||||
|
|
||||||
|
public class EdmConstantAnnotationExpressionImpl implements EdmConstantAnnotationExpression {
|
||||||
|
|
||||||
|
private final ODataValue value;
|
||||||
|
|
||||||
|
public EdmConstantAnnotationExpressionImpl(final Edm edm, final ConstantAnnotationExpression constExprConstruct) {
|
||||||
|
if (constExprConstruct.getType() == ConstantAnnotationExpression.Type.EnumMember) {
|
||||||
|
final List<ODataEnumValue> enumValues = new ArrayList<ODataEnumValue>();
|
||||||
|
String enumTypeName = null;
|
||||||
|
for (String split : StringUtils.split(constExprConstruct.getValue(), ' ')) {
|
||||||
|
final String[] enumSplit = StringUtils.split(split, '/');
|
||||||
|
enumTypeName = enumSplit[0];
|
||||||
|
enumValues.add(new ODataEnumValueImpl(enumSplit[0], enumSplit[1]));
|
||||||
|
}
|
||||||
|
if (enumValues.size() == 1) {
|
||||||
|
value = enumValues.get(0);
|
||||||
|
} else {
|
||||||
|
final ODataCollectionValueImpl collValue = new ODataCollectionValueImpl(enumTypeName);
|
||||||
|
for (ODataValue enumValue : enumValues) {
|
||||||
|
collValue.add(enumValue);
|
||||||
|
}
|
||||||
|
value = collValue;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
final ODataPrimitiveValueImpl.BuilderImpl primitiveValueBuilder =
|
||||||
|
new ODataPrimitiveValueImpl.BuilderImpl(edm.getServiceMetadata().getDataServiceVersion());
|
||||||
|
primitiveValueBuilder.setText(constExprConstruct.getValue());
|
||||||
|
|
||||||
|
switch (constExprConstruct.getType()) {
|
||||||
|
case Binary:
|
||||||
|
primitiveValueBuilder.setType(EdmPrimitiveTypeKind.Binary);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Bool:
|
||||||
|
primitiveValueBuilder.setType(EdmPrimitiveTypeKind.Boolean);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Date:
|
||||||
|
primitiveValueBuilder.setType(EdmPrimitiveTypeKind.Date);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DateTimeOffset:
|
||||||
|
primitiveValueBuilder.setType(EdmPrimitiveTypeKind.DateTimeOffset);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Decimal:
|
||||||
|
primitiveValueBuilder.setType(EdmPrimitiveTypeKind.Decimal);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Duration:
|
||||||
|
primitiveValueBuilder.setType(EdmPrimitiveTypeKind.Duration);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Float:
|
||||||
|
primitiveValueBuilder.setType(EdmPrimitiveTypeKind.Single);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Guid:
|
||||||
|
primitiveValueBuilder.setType(EdmPrimitiveTypeKind.Guid);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Int:
|
||||||
|
primitiveValueBuilder.setType(EdmPrimitiveTypeKind.Int32);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TimeOfDay:
|
||||||
|
primitiveValueBuilder.setType(EdmPrimitiveTypeKind.TimeOfDay);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case String:
|
||||||
|
default:
|
||||||
|
primitiveValueBuilder.setType(EdmPrimitiveTypeKind.String);
|
||||||
|
}
|
||||||
|
|
||||||
|
value = primitiveValueBuilder.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isConstant() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EdmConstantAnnotationExpression asConstant() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isDynamic() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EdmDynamicAnnotationExpression asDynamic() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ODataValue getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,80 @@
|
||||||
|
/*
|
||||||
|
* 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.client.core.edm.v4.annotation;
|
||||||
|
|
||||||
|
import org.apache.olingo.client.api.edm.xml.v4.annotation.IsOf;
|
||||||
|
import org.apache.olingo.commons.api.edm.Edm;
|
||||||
|
import org.apache.olingo.commons.api.edm.EdmType;
|
||||||
|
import org.apache.olingo.commons.api.edm.annotation.EdmDynamicAnnotationExpression;
|
||||||
|
import org.apache.olingo.commons.api.edm.annotation.EdmIsOf;
|
||||||
|
import org.apache.olingo.commons.api.edm.geo.SRID;
|
||||||
|
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
|
||||||
|
import org.apache.olingo.commons.core.edm.annotation.AbstractEdmAnnotatableDynamicAnnotationExpression;
|
||||||
|
|
||||||
|
public class EdmIsOfImpl extends AbstractEdmAnnotatableDynamicAnnotationExpression implements EdmIsOf {
|
||||||
|
|
||||||
|
private final Edm edm;
|
||||||
|
|
||||||
|
private final IsOf isOf;
|
||||||
|
|
||||||
|
private final EdmDynamicAnnotationExpression value;
|
||||||
|
|
||||||
|
private EdmType type;
|
||||||
|
|
||||||
|
public EdmIsOfImpl(final Edm edm, final IsOf isOf, final EdmDynamicAnnotationExpression value) {
|
||||||
|
this.edm = edm;
|
||||||
|
this.isOf = isOf;
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer getMaxLength() {
|
||||||
|
return isOf.getMaxLength();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer getPrecision() {
|
||||||
|
return isOf.getPrecision();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer getScale() {
|
||||||
|
return isOf.getScale();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SRID getSrid() {
|
||||||
|
return isOf.getSrid();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EdmType getType() {
|
||||||
|
if (type == null) {
|
||||||
|
final EdmTypeInfo typeInfo = new EdmTypeInfo.Builder().setEdm(edm).setTypeExpression(isOf.getType()).build();
|
||||||
|
type = typeInfo.getType();
|
||||||
|
}
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EdmDynamicAnnotationExpression getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
/*
|
||||||
|
* 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.client.core.edm.v4.annotation;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.olingo.commons.api.edm.Edm;
|
||||||
|
import org.apache.olingo.commons.api.edm.EdmStructuredType;
|
||||||
|
import org.apache.olingo.commons.api.edm.annotation.EdmPropertyValue;
|
||||||
|
import org.apache.olingo.commons.api.edm.annotation.EdmRecord;
|
||||||
|
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
|
||||||
|
import org.apache.olingo.commons.core.edm.annotation.AbstractEdmAnnotatableDynamicAnnotationExpression;
|
||||||
|
|
||||||
|
public class EdmRecordImpl extends AbstractEdmAnnotatableDynamicAnnotationExpression implements EdmRecord {
|
||||||
|
|
||||||
|
private final Edm edm;
|
||||||
|
|
||||||
|
private final List<EdmPropertyValue> propertyValues;
|
||||||
|
|
||||||
|
private final EdmStructuredType type;
|
||||||
|
|
||||||
|
public EdmRecordImpl(final Edm edm, final String type, final List<EdmPropertyValue> propertyValues) {
|
||||||
|
this.edm = edm;
|
||||||
|
this.propertyValues = propertyValues;
|
||||||
|
|
||||||
|
final EdmTypeInfo typeInfo = new EdmTypeInfo.Builder().setEdm(edm).setTypeExpression(type).build();
|
||||||
|
this.type = typeInfo.getEntityType() == null ? typeInfo.getComplexType() : typeInfo.getEntityType();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EdmPropertyValue> getPropertyValues() {
|
||||||
|
return propertyValues;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EdmStructuredType getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -27,7 +27,7 @@ import com.fasterxml.jackson.dataformat.xml.deser.FromXmlParser;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.apache.olingo.client.core.edm.xml.v4.ReturnTypeImpl;
|
import org.apache.olingo.client.core.edm.xml.v4.ReturnTypeImpl;
|
||||||
import org.apache.olingo.client.core.edm.xml.v4.annotation.ConstExprConstructImpl;
|
import org.apache.olingo.client.core.edm.xml.v4.annotation.ConstantAnnotationExpressionImpl;
|
||||||
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
|
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
|
||||||
|
|
||||||
public abstract class AbstractEdmDeserializer<T> extends JsonDeserializer<T> {
|
public abstract class AbstractEdmDeserializer<T> extends JsonDeserializer<T> {
|
||||||
|
@ -35,12 +35,12 @@ public abstract class AbstractEdmDeserializer<T> extends JsonDeserializer<T> {
|
||||||
protected ODataServiceVersion version;
|
protected ODataServiceVersion version;
|
||||||
|
|
||||||
protected boolean isAnnotationConstExprConstruct(final JsonParser jp) throws IOException {
|
protected boolean isAnnotationConstExprConstruct(final JsonParser jp) throws IOException {
|
||||||
return ConstExprConstructImpl.Type.fromString(jp.getCurrentName()) != null;
|
return ConstantAnnotationExpressionImpl.Type.fromString(jp.getCurrentName()) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ConstExprConstructImpl parseAnnotationConstExprConstruct(final JsonParser jp) throws IOException {
|
protected ConstantAnnotationExpressionImpl parseAnnotationConstExprConstruct(final JsonParser jp) throws IOException {
|
||||||
final ConstExprConstructImpl constExpr = new ConstExprConstructImpl();
|
final ConstantAnnotationExpressionImpl constExpr = new ConstantAnnotationExpressionImpl();
|
||||||
constExpr.setType(ConstExprConstructImpl.Type.fromString(jp.getCurrentName()));
|
constExpr.setType(ConstantAnnotationExpressionImpl.Type.fromString(jp.getCurrentName()));
|
||||||
constExpr.setValue(jp.nextTextValue());
|
constExpr.setValue(jp.nextTextValue());
|
||||||
return constExpr;
|
return constExpr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ package org.apache.olingo.client.core.edm.xml;
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||||
|
|
||||||
import org.apache.olingo.client.api.edm.xml.CommonProperty;
|
import org.apache.olingo.client.api.edm.xml.CommonProperty;
|
||||||
|
import org.apache.olingo.commons.api.edm.geo.SRID;
|
||||||
|
|
||||||
@JsonDeserialize(using = PropertyDeserializer.class)
|
@JsonDeserialize(using = PropertyDeserializer.class)
|
||||||
public abstract class AbstractProperty extends AbstractEdmItem implements CommonProperty {
|
public abstract class AbstractProperty extends AbstractEdmItem implements CommonProperty {
|
||||||
|
@ -43,7 +44,7 @@ public abstract class AbstractProperty extends AbstractEdmItem implements Common
|
||||||
|
|
||||||
private boolean unicode = true;
|
private boolean unicode = true;
|
||||||
|
|
||||||
private String srid;
|
private SRID srid;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
@ -118,11 +119,11 @@ public abstract class AbstractProperty extends AbstractEdmItem implements Common
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getSrid() {
|
public SRID getSrid() {
|
||||||
return srid;
|
return srid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSrid(final String srid) {
|
public void setSrid(final SRID srid) {
|
||||||
this.srid = srid;
|
this.srid = srid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,8 +71,8 @@ public class ComplexTypeDeserializer extends AbstractEdmDeserializer<AbstractCom
|
||||||
org.apache.olingo.client.core.edm.xml.v4.NavigationPropertyImpl.class));
|
org.apache.olingo.client.core.edm.xml.v4.NavigationPropertyImpl.class));
|
||||||
} else if ("Annotation".equals(jp.getCurrentName())) {
|
} else if ("Annotation".equals(jp.getCurrentName())) {
|
||||||
jp.nextToken();
|
jp.nextToken();
|
||||||
((org.apache.olingo.client.core.edm.xml.v4.ComplexTypeImpl) complexType).
|
((org.apache.olingo.client.core.edm.xml.v4.ComplexTypeImpl) complexType).getAnnotations().
|
||||||
setAnnotation(jp.readValueAs(AnnotationImpl.class));
|
add(jp.readValueAs(AnnotationImpl.class));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,8 +90,8 @@ public class EntityContainerDeserializer extends AbstractEdmDeserializer<Abstrac
|
||||||
}
|
}
|
||||||
} else if ("Annotation".equals(jp.getCurrentName())) {
|
} else if ("Annotation".equals(jp.getCurrentName())) {
|
||||||
jp.nextToken();
|
jp.nextToken();
|
||||||
((org.apache.olingo.client.core.edm.xml.v4.EntityContainerImpl) entityContainer).
|
((org.apache.olingo.client.core.edm.xml.v4.EntityContainerImpl) entityContainer).getAnnotations().
|
||||||
setAnnotation(jp.readValueAs(AnnotationImpl.class));
|
add(jp.readValueAs(AnnotationImpl.class));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,8 +57,8 @@ public class EntitySetDeserializer extends AbstractEdmDeserializer<AbstractEntit
|
||||||
jp.readValueAs(NavigationPropertyBindingImpl.class));
|
jp.readValueAs(NavigationPropertyBindingImpl.class));
|
||||||
} else if ("Annotation".equals(jp.getCurrentName())) {
|
} else if ("Annotation".equals(jp.getCurrentName())) {
|
||||||
jp.nextToken();
|
jp.nextToken();
|
||||||
((org.apache.olingo.client.core.edm.xml.v4.EntitySetImpl) entitySet).
|
((org.apache.olingo.client.core.edm.xml.v4.EntitySetImpl) entitySet).getAnnotations().
|
||||||
setAnnotation(jp.readValueAs(AnnotationImpl.class));
|
add(jp.readValueAs(AnnotationImpl.class));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,12 +59,10 @@ public class EntityTypeDeserializer extends AbstractEdmDeserializer<AbstractEnti
|
||||||
jp.nextToken();
|
jp.nextToken();
|
||||||
if (entityType instanceof org.apache.olingo.client.core.edm.xml.v3.EntityTypeImpl) {
|
if (entityType instanceof org.apache.olingo.client.core.edm.xml.v3.EntityTypeImpl) {
|
||||||
((org.apache.olingo.client.core.edm.xml.v3.EntityTypeImpl) entityType).
|
((org.apache.olingo.client.core.edm.xml.v3.EntityTypeImpl) entityType).
|
||||||
getProperties().add(jp.readValueAs(
|
getProperties().add(jp.readValueAs(org.apache.olingo.client.core.edm.xml.v3.PropertyImpl.class));
|
||||||
org.apache.olingo.client.core.edm.xml.v3.PropertyImpl.class));
|
|
||||||
} else {
|
} else {
|
||||||
((org.apache.olingo.client.core.edm.xml.v4.EntityTypeImpl) entityType).
|
((org.apache.olingo.client.core.edm.xml.v4.EntityTypeImpl) entityType).
|
||||||
getProperties().add(jp.readValueAs(
|
getProperties().add(jp.readValueAs(org.apache.olingo.client.core.edm.xml.v4.PropertyImpl.class));
|
||||||
org.apache.olingo.client.core.edm.xml.v4.PropertyImpl.class));
|
|
||||||
}
|
}
|
||||||
} else if ("NavigationProperty".equals(jp.getCurrentName())) {
|
} else if ("NavigationProperty".equals(jp.getCurrentName())) {
|
||||||
jp.nextToken();
|
jp.nextToken();
|
||||||
|
@ -79,8 +77,8 @@ public class EntityTypeDeserializer extends AbstractEdmDeserializer<AbstractEnti
|
||||||
}
|
}
|
||||||
} else if ("Annotation".equals(jp.getCurrentName())) {
|
} else if ("Annotation".equals(jp.getCurrentName())) {
|
||||||
jp.nextToken();
|
jp.nextToken();
|
||||||
((org.apache.olingo.client.core.edm.xml.v4.EntityTypeImpl) entityType).
|
((org.apache.olingo.client.core.edm.xml.v4.EntityTypeImpl) entityType).getAnnotations().
|
||||||
setAnnotation(jp.readValueAs(AnnotationImpl.class));
|
add(jp.readValueAs(AnnotationImpl.class));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,8 +61,8 @@ public class EnumTypeDeserializer extends AbstractEdmDeserializer<AbstractEnumTy
|
||||||
}
|
}
|
||||||
} else if ("Annotation".equals(jp.getCurrentName())) {
|
} else if ("Annotation".equals(jp.getCurrentName())) {
|
||||||
jp.nextToken();
|
jp.nextToken();
|
||||||
((org.apache.olingo.client.core.edm.xml.v4.EnumTypeImpl) enumType).
|
((org.apache.olingo.client.core.edm.xml.v4.EnumTypeImpl) enumType).getAnnotations().
|
||||||
setAnnotation(jp.readValueAs(AnnotationImpl.class));
|
add(jp.readValueAs(AnnotationImpl.class));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,9 @@ import java.io.IOException;
|
||||||
|
|
||||||
import org.apache.commons.lang3.BooleanUtils;
|
import org.apache.commons.lang3.BooleanUtils;
|
||||||
import org.apache.olingo.client.api.edm.xml.v3.ParameterMode;
|
import org.apache.olingo.client.api.edm.xml.v3.ParameterMode;
|
||||||
|
import org.apache.olingo.client.core.edm.xml.v4.AnnotationImpl;
|
||||||
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
|
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
|
||||||
|
import org.apache.olingo.commons.api.edm.geo.SRID;
|
||||||
|
|
||||||
public class ParameterDeserializer extends AbstractEdmDeserializer<AbstractParameter> {
|
public class ParameterDeserializer extends AbstractEdmDeserializer<AbstractParameter> {
|
||||||
|
|
||||||
|
@ -60,7 +62,14 @@ public class ParameterDeserializer extends AbstractEdmDeserializer<AbstractParam
|
||||||
((org.apache.olingo.client.core.edm.xml.v3.ParameterImpl) parameter).
|
((org.apache.olingo.client.core.edm.xml.v3.ParameterImpl) parameter).
|
||||||
setMode(ParameterMode.valueOf(jp.nextTextValue()));
|
setMode(ParameterMode.valueOf(jp.nextTextValue()));
|
||||||
} else if ("SRID".equals(jp.getCurrentName())) {
|
} else if ("SRID".equals(jp.getCurrentName())) {
|
||||||
((org.apache.olingo.client.core.edm.xml.v4.ParameterImpl) parameter).setSrid(jp.nextTextValue());
|
final String srid = jp.nextTextValue();
|
||||||
|
if (srid != null) {
|
||||||
|
((org.apache.olingo.client.core.edm.xml.v4.ParameterImpl) parameter).setSrid(SRID.valueOf(srid));
|
||||||
|
}
|
||||||
|
} else if ("Annotation".equals(jp.getCurrentName())) {
|
||||||
|
jp.nextToken();
|
||||||
|
((org.apache.olingo.client.core.edm.xml.v4.ParameterImpl) parameter).getAnnotations().
|
||||||
|
add(jp.readValueAs(AnnotationImpl.class));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ import com.fasterxml.jackson.core.JsonParser;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.core.JsonToken;
|
import com.fasterxml.jackson.core.JsonToken;
|
||||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||||
|
import org.apache.olingo.commons.api.edm.geo.SRID;
|
||||||
|
|
||||||
public class PropertyDeserializer extends AbstractEdmDeserializer<AbstractProperty> {
|
public class PropertyDeserializer extends AbstractEdmDeserializer<AbstractProperty> {
|
||||||
|
|
||||||
|
@ -74,7 +75,10 @@ public class PropertyDeserializer extends AbstractEdmDeserializer<AbstractProper
|
||||||
setCollation(jp.nextTextValue());
|
setCollation(jp.nextTextValue());
|
||||||
}
|
}
|
||||||
} else if ("SRID".equals(jp.getCurrentName())) {
|
} else if ("SRID".equals(jp.getCurrentName())) {
|
||||||
property.setSrid(jp.nextTextValue());
|
final String srid = jp.nextTextValue();
|
||||||
|
if (srid != null) {
|
||||||
|
property.setSrid(SRID.valueOf(srid));
|
||||||
|
}
|
||||||
} else if ("ConcurrencyMode".equals(jp.getCurrentName())) {
|
} else if ("ConcurrencyMode".equals(jp.getCurrentName())) {
|
||||||
if (property instanceof org.apache.olingo.client.core.edm.xml.v3.PropertyImpl) {
|
if (property instanceof org.apache.olingo.client.core.edm.xml.v3.PropertyImpl) {
|
||||||
((org.apache.olingo.client.core.edm.xml.v3.PropertyImpl) property).
|
((org.apache.olingo.client.core.edm.xml.v3.PropertyImpl) property).
|
||||||
|
@ -116,8 +120,9 @@ public class PropertyDeserializer extends AbstractEdmDeserializer<AbstractProper
|
||||||
setFcKeepInContent(BooleanUtils.toBoolean(jp.nextTextValue()));
|
setFcKeepInContent(BooleanUtils.toBoolean(jp.nextTextValue()));
|
||||||
}
|
}
|
||||||
} else if ("Annotation".equals(jp.getCurrentName())) {
|
} else if ("Annotation".equals(jp.getCurrentName())) {
|
||||||
((org.apache.olingo.client.core.edm.xml.v4.PropertyImpl) property).
|
jp.nextToken();
|
||||||
setAnnotation(jp.readValueAs(AnnotationImpl.class));
|
((org.apache.olingo.client.core.edm.xml.v4.PropertyImpl) property).getAnnotations().
|
||||||
|
add(jp.readValueAs(AnnotationImpl.class));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,7 +106,7 @@ public class SchemaDeserializer extends AbstractEdmDeserializer<AbstractSchema>
|
||||||
org.apache.olingo.client.core.edm.xml.v3.EntityContainerImpl.class));
|
org.apache.olingo.client.core.edm.xml.v3.EntityContainerImpl.class));
|
||||||
} else {
|
} else {
|
||||||
org.apache.olingo.client.core.edm.xml.v4.EntityContainerImpl entityContainer =
|
org.apache.olingo.client.core.edm.xml.v4.EntityContainerImpl entityContainer =
|
||||||
jp.readValueAs(
|
jp.readValueAs(
|
||||||
org.apache.olingo.client.core.edm.xml.v4.EntityContainerImpl.class);
|
org.apache.olingo.client.core.edm.xml.v4.EntityContainerImpl.class);
|
||||||
entityContainer.setDefaultEntityContainer(true);
|
entityContainer.setDefaultEntityContainer(true);
|
||||||
((org.apache.olingo.client.core.edm.xml.v4.SchemaImpl) schema).
|
((org.apache.olingo.client.core.edm.xml.v4.SchemaImpl) schema).
|
||||||
|
@ -115,13 +115,11 @@ public class SchemaDeserializer extends AbstractEdmDeserializer<AbstractSchema>
|
||||||
} else if ("Annotations".equals(jp.getCurrentName())) {
|
} else if ("Annotations".equals(jp.getCurrentName())) {
|
||||||
jp.nextToken();
|
jp.nextToken();
|
||||||
if (schema instanceof org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) {
|
if (schema instanceof org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) {
|
||||||
((org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) schema).getAnnotationsList().
|
((org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) schema).getAnnotationGroups().
|
||||||
add(jp.readValueAs(
|
add(jp.readValueAs(org.apache.olingo.client.core.edm.xml.v3.AnnotationsImpl.class));
|
||||||
org.apache.olingo.client.core.edm.xml.v3.AnnotationsImpl.class));
|
|
||||||
} else {
|
} else {
|
||||||
((org.apache.olingo.client.core.edm.xml.v4.SchemaImpl) schema).getAnnotationsList().
|
((org.apache.olingo.client.core.edm.xml.v4.SchemaImpl) schema).getAnnotationGroups().
|
||||||
add(jp.readValueAs(
|
add(jp.readValueAs(org.apache.olingo.client.core.edm.xml.v4.AnnotationsImpl.class));
|
||||||
org.apache.olingo.client.core.edm.xml.v4.AnnotationsImpl.class));
|
|
||||||
}
|
}
|
||||||
} else if ("Action".equals(jp.getCurrentName())) {
|
} else if ("Action".equals(jp.getCurrentName())) {
|
||||||
jp.nextToken();
|
jp.nextToken();
|
||||||
|
|
|
@ -16,10 +16,11 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.olingo.client.core.edm.v3;
|
package org.apache.olingo.client.core.edm.xml.v3;
|
||||||
|
|
||||||
import org.apache.olingo.client.api.edm.xml.v3.FunctionImport;
|
import org.apache.olingo.client.api.edm.xml.v3.FunctionImport;
|
||||||
import org.apache.olingo.client.api.edm.xml.v4.ReturnType;
|
import org.apache.olingo.client.api.edm.xml.v4.ReturnType;
|
||||||
|
import org.apache.olingo.commons.api.edm.geo.SRID;
|
||||||
|
|
||||||
public class ReturnTypeProxy implements ReturnType {
|
public class ReturnTypeProxy implements ReturnType {
|
||||||
|
|
||||||
|
@ -45,7 +46,7 @@ public class ReturnTypeProxy implements ReturnType {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getSrid() {
|
public SRID getSrid() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,14 +57,14 @@ public class SchemaImpl extends AbstractSchema implements Schema {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Annotations> getAnnotationsList() {
|
public List<Annotations> getAnnotationGroups() {
|
||||||
return annotationList;
|
return annotationList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Annotations getAnnotationsList(final String target) {
|
public Annotations getAnnotationGroup(final String target) {
|
||||||
Annotations result = null;
|
Annotations result = null;
|
||||||
for (Annotations annots : getAnnotationsList()) {
|
for (Annotations annots : getAnnotationGroups()) {
|
||||||
if (target.equals(annots.getTarget())) {
|
if (target.equals(annots.getTarget())) {
|
||||||
result = annots;
|
result = annots;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,28 +18,22 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.olingo.client.core.edm.xml.v4;
|
package org.apache.olingo.client.core.edm.xml.v4;
|
||||||
|
|
||||||
import org.apache.olingo.client.api.edm.xml.v4.AnnotatedEdmItem;
|
import org.apache.olingo.client.api.edm.xml.v4.Annotatable;
|
||||||
import org.apache.olingo.client.api.edm.xml.v4.Annotation;
|
import org.apache.olingo.client.api.edm.xml.v4.Annotation;
|
||||||
import org.apache.olingo.client.core.edm.xml.AbstractEdmItem;
|
import org.apache.olingo.client.core.edm.xml.AbstractEdmItem;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import java.util.ArrayList;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import java.util.List;
|
||||||
|
|
||||||
public abstract class AbstractAnnotatedEdmItem extends AbstractEdmItem implements AnnotatedEdmItem {
|
public abstract class AbstractAnnotatable extends AbstractEdmItem implements Annotatable {
|
||||||
|
|
||||||
private static final long serialVersionUID = -8859729466090997718L;
|
private static final long serialVersionUID = -8859729466090997718L;
|
||||||
|
|
||||||
@JsonProperty("Annotation")
|
private final List<Annotation> annotations = new ArrayList<Annotation>();
|
||||||
private AnnotationImpl annotation;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AnnotationImpl getAnnotation() {
|
public List<Annotation> getAnnotations() {
|
||||||
return annotation;
|
return annotations;
|
||||||
}
|
|
||||||
|
|
||||||
@JsonIgnore
|
|
||||||
public void setAnnotation(final Annotation annotation) {
|
|
||||||
this.annotation = (AnnotationImpl) annotation;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -52,7 +52,7 @@ public class ActionDeserializer extends AbstractEdmDeserializer<ActionImpl> {
|
||||||
action.setReturnType(parseReturnType(jp, "Action"));
|
action.setReturnType(parseReturnType(jp, "Action"));
|
||||||
} else if ("Annotation".equals(jp.getCurrentName())) {
|
} else if ("Annotation".equals(jp.getCurrentName())) {
|
||||||
jp.nextToken();
|
jp.nextToken();
|
||||||
action.setAnnotation(jp.readValueAs(AnnotationImpl.class));
|
action.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ import org.apache.olingo.client.api.edm.xml.v4.Parameter;
|
||||||
import org.apache.olingo.client.api.edm.xml.v4.ReturnType;
|
import org.apache.olingo.client.api.edm.xml.v4.ReturnType;
|
||||||
|
|
||||||
@JsonDeserialize(using = ActionDeserializer.class)
|
@JsonDeserialize(using = ActionDeserializer.class)
|
||||||
public class ActionImpl extends AbstractAnnotatedEdmItem implements Action {
|
public class ActionImpl extends AbstractAnnotatable implements Action {
|
||||||
|
|
||||||
private static final long serialVersionUID = -99977447455438193L;
|
private static final long serialVersionUID = -99977447455438193L;
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
import org.apache.olingo.client.api.edm.xml.v4.ActionImport;
|
import org.apache.olingo.client.api.edm.xml.v4.ActionImport;
|
||||||
|
|
||||||
public class ActionImportImpl extends AbstractAnnotatedEdmItem implements ActionImport {
|
public class ActionImportImpl extends AbstractAnnotatable implements ActionImport {
|
||||||
|
|
||||||
private static final long serialVersionUID = -866422101558426421L;
|
private static final long serialVersionUID = -866422101558426421L;
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ import com.fasterxml.jackson.databind.DeserializationContext;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.apache.olingo.client.core.edm.xml.v4.annotation.DynExprConstructImpl;
|
import org.apache.olingo.client.core.edm.xml.v4.annotation.AbstractDynamicAnnotationExpression;
|
||||||
import org.apache.olingo.client.core.edm.xml.AbstractEdmDeserializer;
|
import org.apache.olingo.client.core.edm.xml.AbstractEdmDeserializer;
|
||||||
|
|
||||||
public class AnnotationDeserializer extends AbstractEdmDeserializer<AnnotationImpl> {
|
public class AnnotationDeserializer extends AbstractEdmDeserializer<AnnotationImpl> {
|
||||||
|
@ -43,12 +43,15 @@ public class AnnotationDeserializer extends AbstractEdmDeserializer<AnnotationIm
|
||||||
annotation.setTerm(jp.nextTextValue());
|
annotation.setTerm(jp.nextTextValue());
|
||||||
} else if ("Qualifier".equals(jp.getCurrentName())) {
|
} else if ("Qualifier".equals(jp.getCurrentName())) {
|
||||||
annotation.setQualifier(jp.nextTextValue());
|
annotation.setQualifier(jp.nextTextValue());
|
||||||
|
} else if ("Annotation".equals(jp.getCurrentName())) {
|
||||||
|
jp.nextToken();
|
||||||
|
annotation.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
|
||||||
} else if (isAnnotationConstExprConstruct(jp)) {
|
} else if (isAnnotationConstExprConstruct(jp)) {
|
||||||
// Constant Expressions
|
// Constant Expressions
|
||||||
annotation.setConstExpr(parseAnnotationConstExprConstruct(jp));
|
annotation.setAnnotationExpression(parseAnnotationConstExprConstruct(jp));
|
||||||
} else {
|
} else {
|
||||||
// Dynamic Expressions
|
// Dynamic Expressions
|
||||||
annotation.setDynExpr(jp.readValueAs(DynExprConstructImpl.class));
|
annotation.setAnnotationExpression(jp.readValueAs(AbstractDynamicAnnotationExpression.class));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue