[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.cud.CommonCUDRequestFactory;
|
||||
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.streamed.CommonStreamedRequestFactory;
|
||||
import org.apache.olingo.client.api.op.ClientODataDeserializer;
|
||||
|
@ -73,7 +73,7 @@ public interface CommonODataClient<UT extends CommonUpdateType> {
|
|||
|
||||
CommonStreamedRequestFactory getStreamedRequestFactory();
|
||||
|
||||
CommonInvokeRequestFactory getInvokeRequestFactory();
|
||||
InvokeRequestFactory getInvokeRequestFactory();
|
||||
|
||||
CommonBatchRequestFactory getBatchRequestFactory();
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ import org.apache.olingo.commons.api.edm.EdmOperation;
|
|||
/**
|
||||
* OData request factory class.
|
||||
*/
|
||||
public interface CommonInvokeRequestFactory extends Serializable {
|
||||
public interface InvokeRequestFactory extends Serializable {
|
||||
|
||||
/**
|
||||
* Gets an invoke request instance.
|
|
@ -18,6 +18,8 @@
|
|||
*/
|
||||
package org.apache.olingo.client.api.edm.xml;
|
||||
|
||||
import org.apache.olingo.commons.api.edm.geo.SRID;
|
||||
|
||||
public interface CommonProperty extends Named {
|
||||
|
||||
String getType();
|
||||
|
@ -34,6 +36,6 @@ public interface CommonProperty extends Named {
|
|||
|
||||
boolean isUnicode();
|
||||
|
||||
String getSrid();
|
||||
SRID getSrid();
|
||||
|
||||
}
|
||||
|
|
|
@ -32,9 +32,9 @@ public interface Schema {
|
|||
|
||||
EnumType getEnumType(String name);
|
||||
|
||||
List<? extends CommonAnnotations> getAnnotationsList();
|
||||
List<? extends CommonAnnotations> getAnnotationGroups();
|
||||
|
||||
CommonAnnotations getAnnotationsList(String target);
|
||||
CommonAnnotations getAnnotationGroup(String target);
|
||||
|
||||
List<? extends ComplexType> getComplexTypes();
|
||||
|
||||
|
|
|
@ -18,7 +18,9 @@
|
|||
*/
|
||||
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();
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ import java.util.List;
|
|||
|
||||
import org.apache.olingo.client.api.edm.xml.Named;
|
||||
|
||||
public interface Action extends Named {
|
||||
public interface Action extends Named, Annotatable {
|
||||
|
||||
boolean isBound();
|
||||
|
||||
|
|
|
@ -18,7 +18,9 @@
|
|||
*/
|
||||
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;
|
||||
|
||||
import org.apache.olingo.client.api.edm.xml.v4.annotation.ConstExprConstruct;
|
||||
import org.apache.olingo.client.api.edm.xml.v4.annotation.DynExprConstruct;
|
||||
import org.apache.olingo.client.api.edm.xml.v4.annotation.AnnotationExpression;
|
||||
|
||||
public interface Annotation {
|
||||
public interface Annotation extends Annotatable {
|
||||
|
||||
String getTerm();
|
||||
|
||||
String getQualifier();
|
||||
|
||||
ConstExprConstruct getConstExpr();
|
||||
|
||||
DynExprConstruct getDynExpr();
|
||||
AnnotationExpression getExpression();
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ import java.util.List;
|
|||
|
||||
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();
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ package org.apache.olingo.client.api.edm.xml.v4;
|
|||
|
||||
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();
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ package org.apache.olingo.client.api.edm.xml.v4;
|
|||
|
||||
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
|
||||
EntitySet getEntitySet(String name);
|
||||
|
|
|
@ -22,7 +22,7 @@ public interface IncludeAnnotations {
|
|||
|
||||
String getQualifier();
|
||||
|
||||
String getTargeyNamespace();
|
||||
String getTargetNamespace();
|
||||
|
||||
String getTermNamespace();
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ import org.apache.olingo.client.api.edm.xml.OnDelete;
|
|||
import java.util.List;
|
||||
import org.apache.olingo.client.api.edm.xml.CommonNavigationProperty;
|
||||
|
||||
public interface NavigationProperty extends CommonNavigationProperty, AnnotatedEdmItem {
|
||||
public interface NavigationProperty extends CommonNavigationProperty, Annotatable {
|
||||
|
||||
String getType();
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ package org.apache.olingo.client.api.edm.xml.v4;
|
|||
|
||||
import org.apache.olingo.client.api.edm.xml.Named;
|
||||
|
||||
public interface OperationImport extends Named, AnnotatedEdmItem {
|
||||
public interface OperationImport extends Named, Annotatable {
|
||||
|
||||
String getEntitySet();
|
||||
|
||||
|
|
|
@ -18,7 +18,10 @@
|
|||
*/
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
public interface ReferentialConstraint {
|
||||
public interface ReferentialConstraint extends Annotatable {
|
||||
|
||||
String getProperty();
|
||||
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
*/
|
||||
package org.apache.olingo.client.api.edm.xml.v4;
|
||||
|
||||
import org.apache.olingo.commons.api.edm.geo.SRID;
|
||||
|
||||
public interface ReturnType {
|
||||
|
||||
Integer getMaxLength();
|
||||
|
@ -26,7 +28,7 @@ public interface ReturnType {
|
|||
|
||||
Integer getScale();
|
||||
|
||||
String getSrid();
|
||||
SRID getSrid();
|
||||
|
||||
String getType();
|
||||
|
||||
|
|
|
@ -19,8 +19,9 @@
|
|||
package org.apache.olingo.client.api.edm.xml.v4;
|
||||
|
||||
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
|
||||
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<Annotation> getAnnotations();
|
||||
Annotation getAnnotation(String term);
|
||||
|
||||
Map<String, Annotatable> getAnnotatables();
|
||||
|
||||
List<Function> getFunctions();
|
||||
|
||||
List<Function> getFunctions(String name);
|
||||
|
||||
Term getTerm(String name);
|
||||
|
||||
List<Term> getTerms();
|
||||
|
||||
TypeDefinition getTypeDefinition(String name);
|
||||
|
@ -56,9 +61,9 @@ public interface Schema extends org.apache.olingo.client.api.edm.xml.Schema, Ann
|
|||
List<TypeDefinition> getTypeDefinitions();
|
||||
|
||||
@Override
|
||||
List<Annotations> getAnnotationsList();
|
||||
List<Annotations> getAnnotationGroups();
|
||||
|
||||
@Override
|
||||
Annotations getAnnotationsList(String target);
|
||||
Annotations getAnnotationGroup(String target);
|
||||
|
||||
}
|
||||
|
|
|
@ -19,12 +19,12 @@
|
|||
package org.apache.olingo.client.api.edm.xml.v4;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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();
|
||||
|
||||
|
@ -36,7 +36,7 @@ public interface Term extends Named {
|
|||
|
||||
Integer getScale();
|
||||
|
||||
String getSrid();
|
||||
SRID getSrid();
|
||||
|
||||
String getType();
|
||||
|
||||
|
|
|
@ -21,8 +21,9 @@ package org.apache.olingo.client.api.edm.xml.v4;
|
|||
import java.util.List;
|
||||
|
||||
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();
|
||||
|
||||
|
@ -32,7 +33,7 @@ public interface TypeDefinition extends Named {
|
|||
|
||||
Integer getScale();
|
||||
|
||||
String getSrid();
|
||||
SRID getSrid();
|
||||
|
||||
String getUnderlyingType();
|
||||
|
||||
|
|
|
@ -16,9 +16,15 @@
|
|||
* specific language governing permissions and limitations
|
||||
* 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
|
||||
* 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;
|
||||
|
||||
public interface ConstExprConstruct extends ExprConstruct {
|
||||
public interface ConstantAnnotationExpression extends AnnotationExpression {
|
||||
|
||||
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
|
||||
* 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
|
||||
* 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;
|
||||
|
||||
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
|
||||
* 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
|
||||
* 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
|
||||
* 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,
|
||||
ComplexType,
|
||||
EntityContainer,
|
||||
EntitySet,
|
||||
EntityType,
|
||||
EnumType,
|
||||
FunctionImport,
|
||||
Member,
|
||||
NavigationProperty,
|
||||
Property,
|
||||
Singleton,
|
||||
Term,
|
||||
TypeDefinition
|
||||
public interface PropertyValue extends DynamicAnnotationExpression, Annotatable {
|
||||
|
||||
String getProperty();
|
||||
|
||||
AnnotationExpression getValue();
|
||||
|
||||
}
|
|
@ -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
|
||||
* 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 class DynExprSingleParamOp extends DynExprConstructImpl {
|
||||
|
||||
private static final long serialVersionUID = -7974475975925167731L;
|
||||
public interface TwoParamsOpDynamicAnnotationExpression extends DynamicAnnotationExpression {
|
||||
|
||||
public static enum Type {
|
||||
|
||||
Not,
|
||||
And,
|
||||
Or,
|
||||
Eq,
|
||||
Ne,
|
||||
Gt,
|
||||
|
@ -43,27 +40,11 @@ public class DynExprSingleParamOp extends DynExprConstructImpl {
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private Type type;
|
||||
|
||||
private DynExprConstruct expression;
|
||||
|
||||
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;
|
||||
}
|
||||
Type getType();
|
||||
|
||||
DynamicAnnotationExpression getLeftExpression();
|
||||
|
||||
DynamicAnnotationExpression getRightExpression();
|
||||
}
|
|
@ -18,6 +18,8 @@
|
|||
*/
|
||||
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.cud.v3.CUDRequestFactory;
|
||||
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.streamed.v3.StreamedRequestFactory;
|
||||
import org.apache.olingo.client.api.op.v3.ODataBinder;
|
||||
|
@ -64,9 +63,6 @@ public interface ODataClient extends CommonODataClient<UpdateType> {
|
|||
@Override
|
||||
StreamedRequestFactory getStreamedRequestFactory();
|
||||
|
||||
@Override
|
||||
InvokeRequestFactory getInvokeRequestFactory();
|
||||
|
||||
@Override
|
||||
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.cud.v4.CUDRequestFactory;
|
||||
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.streamed.v4.StreamedRequestFactory;
|
||||
import org.apache.olingo.client.api.communication.request.v4.AsyncRequestFactory;
|
||||
|
@ -67,9 +66,6 @@ public interface ODataClient extends CommonODataClient<UpdateType> {
|
|||
@Override
|
||||
StreamedRequestFactory getStreamedRequestFactory();
|
||||
|
||||
@Override
|
||||
InvokeRequestFactory getInvokeRequestFactory();
|
||||
|
||||
@Override
|
||||
BatchRequestFactory getBatchRequestFactory();
|
||||
}
|
||||
|
|
|
@ -19,22 +19,15 @@
|
|||
package org.apache.olingo.client.core.communication.request.invoke;
|
||||
|
||||
import java.net.URI;
|
||||
import org.apache.olingo.client.api.CommonODataClient;
|
||||
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.invoke.ODataInvokeRequest;
|
||||
import org.apache.olingo.commons.api.domain.ODataInvokeResult;
|
||||
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;
|
||||
|
||||
protected final CommonODataClient client;
|
||||
|
||||
protected AbstractInvokeRequestFactory(final CommonODataClient client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <RES extends ODataInvokeResult> ODataInvokeRequest<RES> getInvokeRequest(
|
||||
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.communication.request.invoke.ODataInvokeRequest;
|
||||
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.ODataValue;
|
||||
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.constants.EdmTypeKind;
|
||||
|
||||
public class InvokeRequestFactoryImpl extends AbstractInvokeRequestFactory implements InvokeRequestFactory {
|
||||
public class InvokeRequestFactoryImpl extends AbstractInvokeRequestFactory {
|
||||
|
||||
private static final long serialVersionUID = -659256862901915496L;
|
||||
|
||||
private final ODataClient client;
|
||||
|
||||
public InvokeRequestFactoryImpl(final ODataClient client) {
|
||||
super(client);
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -23,7 +23,6 @@ import java.util.Map;
|
|||
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.ODataNoContent;
|
||||
import org.apache.olingo.client.api.communication.request.invoke.v4.InvokeRequestFactory;
|
||||
import org.apache.olingo.client.api.http.HttpMethod;
|
||||
import org.apache.olingo.commons.api.domain.ODataInvokeResult;
|
||||
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.constants.EdmTypeKind;
|
||||
|
||||
public class InvokeRequestFactoryImpl extends AbstractInvokeRequestFactory implements InvokeRequestFactory {
|
||||
public class InvokeRequestFactoryImpl extends AbstractInvokeRequestFactory {
|
||||
|
||||
private static final long serialVersionUID = 8452737360003104372L;
|
||||
|
||||
private final ODataClient client;
|
||||
|
||||
public InvokeRequestFactoryImpl(final ODataClient client) {
|
||||
super(client);
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
|
|
@ -18,18 +18,23 @@
|
|||
*/
|
||||
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.commons.core.edm.EdmTypeInfo;
|
||||
import org.apache.olingo.commons.api.edm.Edm;
|
||||
import org.apache.olingo.commons.api.edm.EdmAction;
|
||||
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.FullQualifiedName;
|
||||
import org.apache.olingo.commons.core.edm.EdmAnnotationHelper;
|
||||
|
||||
public class EdmActionImportImpl extends EdmOperationImportImpl implements EdmActionImport {
|
||||
|
||||
private final ActionImport actionImport;
|
||||
|
||||
private final EdmAnnotationHelper helper;
|
||||
|
||||
private FullQualifiedName actionFQN;
|
||||
|
||||
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());
|
||||
this.actionImport = actionImport;
|
||||
this.helper = new EdmAnnotationHelperImpl(edm, actionImport);
|
||||
}
|
||||
|
||||
public FullQualifiedName getActionFQN() {
|
||||
|
@ -52,4 +58,13 @@ public class EdmActionImportImpl extends EdmOperationImportImpl implements EdmAc
|
|||
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.NavigationPropertyBinding;
|
||||
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.EdmEntityContainer;
|
||||
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.Target;
|
||||
import org.apache.olingo.commons.core.edm.AbstractEdmBindingTarget;
|
||||
import org.apache.olingo.commons.core.edm.EdmAnnotationHelper;
|
||||
import org.apache.olingo.commons.core.edm.EdmNavigationPropertyBindingImpl;
|
||||
|
||||
public abstract class EdmBindingTargetImpl extends AbstractEdmBindingTarget {
|
||||
|
||||
private final BindingTarget target;
|
||||
|
||||
private final EdmAnnotationHelper helper;
|
||||
|
||||
private List<EdmNavigationPropertyBinding> navigationPropertyBindings;
|
||||
|
||||
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);
|
||||
this.target = target;
|
||||
this.helper = new EdmAnnotationHelperImpl(edm, target);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -53,8 +59,8 @@ public abstract class EdmBindingTargetImpl extends AbstractEdmBindingTarget {
|
|||
final List<? extends NavigationPropertyBinding> navigationPropertyBindings = target.getNavigationPropertyBindings();
|
||||
boolean found = false;
|
||||
for (final Iterator<? extends NavigationPropertyBinding> itor = navigationPropertyBindings.iterator(); itor
|
||||
.hasNext()
|
||||
&& !found;) {
|
||||
.hasNext()
|
||||
&& !found;) {
|
||||
|
||||
final NavigationPropertyBinding binding = itor.next();
|
||||
if (binding.getPath().equals(path)) {
|
||||
|
@ -95,4 +101,9 @@ public abstract class EdmBindingTargetImpl extends AbstractEdmBindingTarget {
|
|||
return navigationPropertyBindings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EdmAnnotation> getAnnotations() {
|
||||
return helper.getAnnotations();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,21 +18,19 @@
|
|||
*/
|
||||
package org.apache.olingo.client.core.edm;
|
||||
|
||||
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
|
||||
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.ComplexType;
|
||||
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.v3.FunctionImport;
|
||||
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.Term;
|
||||
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.EdmFunctionProxy;
|
||||
import org.apache.olingo.client.core.edm.v3.FunctionImportUtils;
|
||||
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.EdmEntityContainer;
|
||||
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.EdmSchema;
|
||||
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.FullQualifiedName;
|
||||
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
|
||||
import org.apache.olingo.commons.core.edm.AbstractEdm;
|
||||
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
|
||||
|
||||
public class EdmClientImpl extends AbstractEdm {
|
||||
|
||||
|
@ -101,6 +107,15 @@ public class EdmClientImpl extends AbstractEdm {
|
|||
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
|
||||
protected EdmEntityContainer createEntityContainer(final FullQualifiedName containerName) {
|
||||
EdmEntityContainer result = null;
|
||||
|
@ -142,8 +157,6 @@ public class EdmClientImpl extends AbstractEdm {
|
|||
if (xmlTypeDefinition != null) {
|
||||
result = new EdmTypeDefinitionImpl(version, this, typeDefinitionName, xmlTypeDefinition);
|
||||
}
|
||||
} else {
|
||||
throw new UnsupportedInV3Exception();
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -407,6 +420,57 @@ public class EdmClientImpl extends AbstractEdm {
|
|||
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
|
||||
public boolean equals(final Object obj) {
|
||||
return EqualsBuilder.reflectionEquals(this, obj);
|
||||
|
@ -421,13 +485,4 @@ public class EdmClientImpl extends AbstractEdm {
|
|||
public String toString() {
|
||||
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.Schema;
|
||||
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.EdmProperty;
|
||||
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
||||
import org.apache.olingo.commons.core.edm.AbstractEdmComplexType;
|
||||
import org.apache.olingo.commons.core.edm.EdmAnnotationHelper;
|
||||
import org.apache.olingo.commons.core.edm.EdmStructuredTypeHelper;
|
||||
|
||||
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,
|
||||
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) {
|
||||
|
||||
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
|
||||
protected Map<String, EdmProperty> getProperties() {
|
||||
return helper.getProperties();
|
||||
return typeHelper.getProperties();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<String, EdmNavigationProperty> getNavigationProperties() {
|
||||
return helper.getNavigationProperties();
|
||||
return typeHelper.getNavigationProperties();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpenType() {
|
||||
return helper.isOpenType();
|
||||
return typeHelper.isOpenType();
|
||||
}
|
||||
|
||||
@Override
|
||||
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;
|
||||
|
||||
import java.util.Collections;
|
||||
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
|
||||
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.commons.api.edm.Edm;
|
||||
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.EdmException;
|
||||
import org.apache.olingo.commons.api.edm.EdmFunctionImport;
|
||||
import org.apache.olingo.commons.api.edm.EdmSingleton;
|
||||
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
||||
import org.apache.olingo.commons.core.edm.AbstractEdmEntityContainer;
|
||||
import org.apache.olingo.commons.core.edm.EdmAnnotationHelper;
|
||||
|
||||
public class EdmEntityContainerImpl extends AbstractEdmEntityContainer {
|
||||
|
||||
|
@ -47,6 +49,8 @@ public class EdmEntityContainerImpl extends AbstractEdmEntityContainer {
|
|||
|
||||
private final List<? extends Schema> xmlSchemas;
|
||||
|
||||
private EdmAnnotationHelper helper;
|
||||
|
||||
public EdmEntityContainerImpl(final Edm edm, final FullQualifiedName entityContainerName,
|
||||
final EntityContainer xmlEntityContainer, final List<? extends Schema> xmlSchemas) {
|
||||
|
||||
|
@ -55,6 +59,10 @@ public class EdmEntityContainerImpl extends AbstractEdmEntityContainer {
|
|||
|
||||
this.xmlEntityContainer = xmlEntityContainer;
|
||||
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
|
||||
|
@ -72,63 +80,69 @@ public class EdmEntityContainerImpl extends AbstractEdmEntityContainer {
|
|||
|
||||
final Singleton singleton = ((org.apache.olingo.client.api.edm.xml.v4.EntityContainer) xmlEntityContainer).
|
||||
getSingleton(singletonName);
|
||||
if (singleton == null) {
|
||||
throw new EdmException("Singleton named '" + singletonName + "' not found in " + entityContainerName);
|
||||
}
|
||||
return new EdmSingletonImpl(edm, this, singletonName, new EdmTypeInfo.Builder().
|
||||
setTypeExpression(singleton.getEntityType()).setDefaultNamespace(entityContainerName.getNamespace()).
|
||||
build().getFullQualifiedName(), singleton);
|
||||
return singleton == null
|
||||
? null
|
||||
: new EdmSingletonImpl(edm, this, singletonName, new EdmTypeInfo.Builder().
|
||||
setTypeExpression(singleton.getEntityType()).
|
||||
setDefaultNamespace(entityContainerName.getNamespace()).
|
||||
build().getFullQualifiedName(), singleton);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected EdmEntitySet createEntitySet(final String entitySetName) {
|
||||
EdmEntitySet result = null;
|
||||
|
||||
final EntitySet entitySet = xmlEntityContainer.getEntitySet(entitySetName);
|
||||
if (entitySet == null) {
|
||||
throw new EdmException("EntitySet named '" + entitySetName + "' not found in " + entityContainerName);
|
||||
if (entitySet != null) {
|
||||
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()).
|
||||
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);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected EdmActionImport createActionImport(final String actionImportName) {
|
||||
EdmActionImport result = null;
|
||||
|
||||
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).
|
||||
getActionImport(actionImportName);
|
||||
if (actionImport == null) {
|
||||
throw new EdmException("ActionImport named '" + actionImportName + "' not found in " + entityContainerName);
|
||||
if (actionImport != null) {
|
||||
result = new EdmActionImportImpl(edm, this, actionImportName, actionImport);
|
||||
}
|
||||
return new EdmActionImportImpl(edm, this, actionImportName, actionImport);
|
||||
} else {
|
||||
final FunctionImport functionImport = (FunctionImport) xmlEntityContainer.getFunctionImport(actionImportName);
|
||||
if (functionImport == null) {
|
||||
throw new EdmException("FunctionImport named '" + actionImportName + "' not found in " + entityContainerName);
|
||||
if (functionImport != null) {
|
||||
result = new EdmActionImportProxy(edm, this, actionImportName, functionImport);
|
||||
}
|
||||
return new EdmActionImportProxy(edm, this, actionImportName, functionImport);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected EdmFunctionImport createFunctionImport(final String functionImportName) {
|
||||
EdmFunctionImport result = null;
|
||||
|
||||
final CommonFunctionImport functionImport = xmlEntityContainer.getFunctionImport(functionImportName);
|
||||
if (functionImport == null) {
|
||||
throw new EdmException("FunctionImport named '" + functionImportName + "' not found in " + entityContainerName);
|
||||
if (functionImport != null) {
|
||||
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 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);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@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 {
|
||||
|
||||
private EntitySet entitySet;
|
||||
private final EntitySet entitySet;
|
||||
|
||||
public EdmEntitySetImpl(final Edm edm, final EdmEntityContainer container, final String name,
|
||||
final FullQualifiedName type, final EntitySet entitySet) {
|
||||
|
||||
super(edm, container, name, type, entitySet);
|
||||
|
||||
this.entitySet = entitySet;
|
||||
}
|
||||
|
||||
|
@ -39,4 +40,9 @@ public class EdmEntitySetImpl extends EdmBindingTargetImpl implements EdmEntityS
|
|||
public boolean 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.Schema;
|
||||
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.EdmKeyPropertyRef;
|
||||
import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
|
||||
import org.apache.olingo.commons.api.edm.EdmProperty;
|
||||
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
||||
import org.apache.olingo.commons.core.edm.AbstractEdmEntityType;
|
||||
import org.apache.olingo.commons.core.edm.EdmAnnotationHelper;
|
||||
import org.apache.olingo.commons.core.edm.EdmStructuredTypeHelper;
|
||||
|
||||
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 FullQualifiedName baseTypeName = entityType.getBaseType() == null
|
||||
? null
|
||||
: 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) {
|
||||
|
||||
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
|
||||
protected Map<String, EdmProperty> getProperties() {
|
||||
return helper.getProperties();
|
||||
return typeHelper.getProperties();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<String, EdmNavigationProperty> getNavigationProperties() {
|
||||
return helper.getNavigationProperties();
|
||||
return typeHelper.getNavigationProperties();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpenType() {
|
||||
return helper.isOpenType();
|
||||
return typeHelper.isOpenType();
|
||||
}
|
||||
|
||||
@Override
|
||||
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;
|
||||
|
||||
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.Member;
|
||||
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.FullQualifiedName;
|
||||
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.olingo.commons.api.edm.EdmException;
|
||||
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());
|
||||
for (Member xmlMember : xmlMembers) {
|
||||
_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.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.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.EdmFunction;
|
||||
import org.apache.olingo.commons.api.edm.EdmFunctionImport;
|
||||
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
||||
import org.apache.olingo.commons.core.edm.EdmAnnotationHelper;
|
||||
|
||||
public class EdmFunctionImportImpl extends EdmOperationImportImpl implements EdmFunctionImport {
|
||||
|
||||
private final FunctionImport functionImport;
|
||||
|
||||
private final EdmAnnotationHelper helper;
|
||||
|
||||
private FullQualifiedName functionFQN;
|
||||
|
||||
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());
|
||||
this.functionImport = functionImport;
|
||||
this.helper = new EdmAnnotationHelperImpl(edm, functionImport);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TargetType getAnnotationsTargetType() {
|
||||
return TargetType.FunctionImport;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -65,4 +75,9 @@ public class EdmFunctionImportImpl extends EdmOperationImportImpl implements Edm
|
|||
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.ReferentialConstraint;
|
||||
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.FullQualifiedName;
|
||||
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;
|
||||
|
||||
public class EdmNavigationPropertyImpl extends AbstractEdmNavigationProperty {
|
||||
|
||||
private final FullQualifiedName structuredTypeName;
|
||||
|
||||
private final NavigationProperty navigationProperty;
|
||||
|
||||
private final EdmTypeInfo edmTypeInfo;
|
||||
|
||||
private final EdmAnnotationHelper helper;
|
||||
|
||||
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());
|
||||
|
||||
this.structuredTypeName = structuredTypeName;
|
||||
this.navigationProperty = navigationProperty;
|
||||
this.edmTypeInfo = new EdmTypeInfo.Builder().setTypeExpression(navigationProperty.getType()).build();
|
||||
this.helper = new EdmAnnotationHelperImpl(edm, navigationProperty);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -71,11 +81,9 @@ public class EdmNavigationPropertyImpl extends AbstractEdmNavigationProperty {
|
|||
|
||||
@Override
|
||||
public String getReferencingPropertyName(final String referencedPropertyName) {
|
||||
final List<? extends ReferentialConstraint> _referentialConstraints =
|
||||
navigationProperty.getReferentialConstraints();
|
||||
for (ReferentialConstraint constraint : _referentialConstraints) {
|
||||
if (constraint.getReferencedProperty().equals(referencedPropertyName)) {
|
||||
return constraint.getProperty();
|
||||
for (EdmReferentialConstraint constraint : getReferentialConstraints()) {
|
||||
if (constraint.getReferencedPropertyName().equals(referencedPropertyName)) {
|
||||
return constraint.getPropertyName();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -89,12 +97,21 @@ public class EdmNavigationPropertyImpl extends AbstractEdmNavigationProperty {
|
|||
referentialConstraints = new ArrayList<EdmReferentialConstraint>();
|
||||
if (providerConstraints != null) {
|
||||
for (ReferentialConstraint constraint : providerConstraints) {
|
||||
referentialConstraints.add(
|
||||
new EdmReferentialConstraintImpl(constraint.getProperty(), constraint.getReferencedProperty()));
|
||||
referentialConstraints.add(new EdmReferentialConstraintImpl(edm, constraint));
|
||||
}
|
||||
}
|
||||
}
|
||||
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.v4.Action;
|
||||
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.FullQualifiedName;
|
||||
import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
|
||||
import org.apache.olingo.commons.core.edm.AbstractEdmOperation;
|
||||
import org.apache.olingo.commons.core.edm.EdmAnnotationHelper;
|
||||
|
||||
public abstract class EdmOperationImpl extends AbstractEdmOperation {
|
||||
|
||||
protected final Action operation;
|
||||
|
||||
protected final EdmAnnotationHelper helper;
|
||||
|
||||
protected static <T extends EdmOperationImpl> T getInstance(final T instance) {
|
||||
final List<? extends CommonParameter> parameters = instance.operation.getParameters();
|
||||
final List<EdmParameter> _parameters = new ArrayList<EdmParameter>(parameters.size());
|
||||
for (CommonParameter parameter : parameters) {
|
||||
_parameters.add(EdmParameterImpl.getInstance(instance.edm, parameter));
|
||||
_parameters.add(new EdmParameterImpl(instance.edm, parameter));
|
||||
}
|
||||
instance.setParameters(_parameters);
|
||||
|
||||
|
@ -57,6 +61,7 @@ public abstract class EdmOperationImpl extends AbstractEdmOperation {
|
|||
|
||||
super(edm, name, kind);
|
||||
this.operation = operation;
|
||||
this.helper = new EdmAnnotationHelperImpl(edm, operation);
|
||||
}
|
||||
|
||||
private EdmParameter getBindingParameter() {
|
||||
|
@ -87,4 +92,10 @@ public abstract class EdmOperationImpl extends AbstractEdmOperation {
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EdmAnnotation> getAnnotations() {
|
||||
return helper.getAnnotations();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,7 +18,10 @@
|
|||
*/
|
||||
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.EdmAnnotation;
|
||||
import org.apache.olingo.commons.api.edm.EdmEntityContainer;
|
||||
import org.apache.olingo.commons.api.edm.Target;
|
||||
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());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EdmAnnotation> getAnnotations() {
|
||||
return Collections.<EdmAnnotation>emptyList();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,32 +18,39 @@
|
|||
*/
|
||||
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.v4.Parameter;
|
||||
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.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.EdmAnnotationHelper;
|
||||
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
|
||||
|
||||
public class EdmParameterImpl extends AbstractEdmParameter {
|
||||
|
||||
private final CommonParameter parameter;
|
||||
|
||||
private final EdmTypeInfo parameterInfo;
|
||||
private final EdmTypeInfo typeInfo;
|
||||
|
||||
public static EdmParameterImpl getInstance(final Edm edm, final CommonParameter parameter) {
|
||||
final EdmTypeInfo paramTypeInfo = new EdmTypeInfo.Builder().setTypeExpression(parameter.getType()).build();
|
||||
return new EdmParameterImpl(edm, parameter, paramTypeInfo);
|
||||
}
|
||||
private EdmAnnotationHelper helper;
|
||||
|
||||
private EdmParameterImpl(final Edm edm, final CommonParameter parameter, final EdmTypeInfo parameterInfo) {
|
||||
super(edm, parameter.getName(), parameterInfo.getFullQualifiedName());
|
||||
public EdmParameterImpl(final Edm edm, final CommonParameter parameter) {
|
||||
super(edm, parameter.getName(), new FullQualifiedName(parameter.getType()));
|
||||
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
|
||||
public boolean isCollection() {
|
||||
return parameterInfo.isCollection();
|
||||
return typeInfo.isCollection();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -71,4 +78,16 @@ public class EdmParameterImpl extends AbstractEdmParameter {
|
|||
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;
|
||||
|
||||
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.v4.Property;
|
||||
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.EdmProperty;
|
||||
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.EdmAnnotationHelper;
|
||||
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
|
||||
|
||||
public class EdmPropertyImpl extends AbstractEdmProperty implements EdmProperty {
|
||||
|
||||
private final FullQualifiedName structuredTypeName;
|
||||
|
||||
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());
|
||||
|
||||
this.structuredTypeName = structuredTypeName;
|
||||
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
|
||||
protected FullQualifiedName getTypeFQN() {
|
||||
return edmTypeInfo.getFullQualifiedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCollection() {
|
||||
return edmTypeInfo.isCollection();
|
||||
protected EdmTypeInfo getTypeInfo() {
|
||||
return typeInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -88,4 +98,21 @@ public class EdmPropertyImpl extends AbstractEdmProperty implements EdmProperty
|
|||
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;
|
||||
|
||||
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
|
||||
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.geo.SRID;
|
||||
import org.apache.olingo.commons.core.edm.AbstractEdmReturnType;
|
||||
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
|
||||
|
||||
public class EdmReturnTypeImpl extends AbstractEdmReturnType {
|
||||
|
||||
private final ReturnType returnType;
|
||||
|
||||
private final EdmTypeInfo returnTypeInfo;
|
||||
private final boolean isCollection;
|
||||
|
||||
public static EdmReturnTypeImpl getInstance(final Edm edm, final ReturnType returnType) {
|
||||
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) {
|
||||
super(edm, returnTypeInfo.getFullQualifiedName());
|
||||
this.returnType = returnType;
|
||||
this.returnTypeInfo = returnTypeInfo;
|
||||
this.isCollection = returnTypeInfo.isCollection();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCollection() {
|
||||
return isCollection;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -61,8 +67,10 @@ public class EdmReturnTypeImpl extends AbstractEdmReturnType {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isCollection() {
|
||||
return returnTypeInfo.isCollection();
|
||||
public SRID getSrid() {
|
||||
return (returnType instanceof ReturnType)
|
||||
? ((ReturnType) returnType).getSrid()
|
||||
: null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ import java.util.ArrayList;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
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.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.v3.FunctionImport;
|
||||
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.Term;
|
||||
import org.apache.olingo.client.api.edm.xml.v4.TypeDefinition;
|
||||
import org.apache.olingo.client.core.edm.v3.EdmFunctionProxy;
|
||||
import org.apache.olingo.commons.api.edm.Edm;
|
||||
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.EdmEntityContainer;
|
||||
import org.apache.olingo.commons.api.edm.EdmEntityType;
|
||||
import org.apache.olingo.commons.api.edm.EdmEnumType;
|
||||
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.FullQualifiedName;
|
||||
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
|
||||
|
@ -92,6 +97,7 @@ public class EdmSchemaImpl extends AbstractEdmSchema {
|
|||
|
||||
@Override
|
||||
public EdmEntityContainer getEntityContainer(final FullQualifiedName name) {
|
||||
getEntityContainers();
|
||||
return entityContainerByName.get(name);
|
||||
}
|
||||
|
||||
|
@ -210,4 +216,48 @@ public class EdmSchemaImpl extends AbstractEdmSchema {
|
|||
}
|
||||
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);
|
||||
}
|
||||
|
||||
@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.EdmNavigationProperty;
|
||||
import org.apache.olingo.commons.api.edm.EdmProperty;
|
||||
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
||||
import org.apache.olingo.commons.core.edm.EdmStructuredTypeHelper;
|
||||
|
||||
public class EdmStructuredTypeHelperImpl implements EdmStructuredTypeHelper {
|
||||
|
||||
private final Edm edm;
|
||||
|
||||
private final FullQualifiedName structuredTypeName;
|
||||
|
||||
private final ComplexType complexType;
|
||||
|
||||
private final List<? extends Schema> xmlSchemas;
|
||||
|
@ -45,10 +48,11 @@ public class EdmStructuredTypeHelperImpl implements EdmStructuredTypeHelper {
|
|||
|
||||
private Map<String, EdmNavigationProperty> navigationProperties;
|
||||
|
||||
public EdmStructuredTypeHelperImpl(
|
||||
final Edm edm, final List<? extends Schema> xmlSchemas, final ComplexType complexType) {
|
||||
public EdmStructuredTypeHelperImpl(final Edm edm, final FullQualifiedName structuredTypeName,
|
||||
final List<? extends Schema> xmlSchemas, final ComplexType complexType) {
|
||||
|
||||
this.edm = edm;
|
||||
this.structuredTypeName = structuredTypeName;
|
||||
this.complexType = complexType;
|
||||
this.xmlSchemas = xmlSchemas;
|
||||
}
|
||||
|
@ -58,7 +62,7 @@ public class EdmStructuredTypeHelperImpl implements EdmStructuredTypeHelper {
|
|||
if (properties == null) {
|
||||
properties = new LinkedHashMap<String, EdmProperty>();
|
||||
for (CommonProperty property : complexType.getProperties()) {
|
||||
properties.put(property.getName(), new EdmPropertyImpl(edm, property));
|
||||
properties.put(property.getName(), new EdmPropertyImpl(edm, structuredTypeName, property));
|
||||
}
|
||||
}
|
||||
return properties;
|
||||
|
@ -71,10 +75,12 @@ public class EdmStructuredTypeHelperImpl implements EdmStructuredTypeHelper {
|
|||
for (CommonNavigationProperty navigationProperty : complexType.getNavigationProperties()) {
|
||||
if (navigationProperty instanceof org.apache.olingo.client.api.edm.xml.v4.NavigationProperty) {
|
||||
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) {
|
||||
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;
|
||||
|
||||
import java.util.List;
|
||||
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.EdmAnnotation;
|
||||
import org.apache.olingo.commons.api.edm.EdmException;
|
||||
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
|
||||
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
|
||||
import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
|
||||
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
||||
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.EdmAnnotationHelper;
|
||||
import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
|
||||
|
||||
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,
|
||||
final FullQualifiedName typeDefinitionName, final TypeDefinition typeDefinition) {
|
||||
|
@ -46,6 +52,7 @@ public class EdmTypeDefinitionImpl extends AbstractEdmTypeDefinition implements
|
|||
} catch (IllegalArgumentException e) {
|
||||
throw new EdmException("Invalid underlying type: " + typeDefinition.getUnderlyingType(), e);
|
||||
}
|
||||
this.helper = new EdmAnnotationHelperImpl(edm, typeDefinition);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -68,8 +75,19 @@ public class EdmTypeDefinitionImpl extends AbstractEdmTypeDefinition implements
|
|||
return typeDefinition.getScale();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SRID getSrid() {
|
||||
return typeDefinition.getSrid();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean 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());
|
||||
}
|
||||
|
||||
@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.SchemaImpl;
|
||||
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.EdmEntityContainer;
|
||||
import org.apache.olingo.commons.api.edm.EdmEntitySet;
|
||||
|
@ -113,4 +114,14 @@ public class EdmEntitySetProxy extends AbstractEdmBindingTarget implements EdmEn
|
|||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TargetType getAnnotationsTargetType() {
|
||||
return TargetType.FunctionImport;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -40,4 +40,5 @@ public class EdmFunctionProxy extends EdmOperationProxy implements EdmFunction {
|
|||
public boolean isComposable() {
|
||||
return functionImport.isComposable();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,20 +19,23 @@
|
|||
package org.apache.olingo.client.core.edm.v3;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
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.AssociationEnd;
|
||||
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.core.edm.EdmReferentialConstraintImpl;
|
||||
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.EdmAnnotation;
|
||||
import org.apache.olingo.commons.api.edm.EdmEntityType;
|
||||
import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
|
||||
import org.apache.olingo.commons.api.edm.EdmReferentialConstraint;
|
||||
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
||||
import org.apache.olingo.commons.core.edm.AbstractEdmNavigationProperty;
|
||||
import org.apache.olingo.commons.core.edm.EdmReferentialConstraintImpl;
|
||||
|
||||
public class EdmNavigationPropertyProxy extends AbstractEdmNavigationProperty {
|
||||
|
||||
|
@ -120,7 +123,7 @@ public class EdmNavigationPropertyProxy extends AbstractEdmNavigationProperty {
|
|||
|
||||
@Override
|
||||
public EdmNavigationProperty getPartner() {
|
||||
return partner == null ? this: partner;
|
||||
return partner == null ? this : partner;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -156,13 +159,24 @@ public class EdmNavigationPropertyProxy extends AbstractEdmNavigationProperty {
|
|||
referentialConstraints = new ArrayList<EdmReferentialConstraint>();
|
||||
if (constraint != null) {
|
||||
for (int i = 0; i < constraint.getPrincipal().getPropertyRefs().size(); i++) {
|
||||
referentialConstraints.add(new EdmReferentialConstraintImpl(
|
||||
constraint.getPrincipal().getPropertyRefs().get(i).getName(),
|
||||
constraint.getDependent().getPropertyRefs().get(i).getName()));
|
||||
final ReferentialConstraintImpl referentialConstraint = new ReferentialConstraintImpl();
|
||||
referentialConstraint.setProperty(constraint.getPrincipal().getPropertyRefs().get(i).getName());
|
||||
referentialConstraint.setReferencedProperty(constraint.getDependent().getPropertyRefs().get(i).getName());
|
||||
referentialConstraints.add(new EdmReferentialConstraintImpl(edm, referentialConstraint));
|
||||
}
|
||||
}
|
||||
}
|
||||
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;
|
||||
|
||||
import org.apache.olingo.client.core.edm.xml.v3.ReturnTypeProxy;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
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.EdmReturnTypeImpl;
|
||||
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.FullQualifiedName;
|
||||
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<EdmParameter> _parameters = new ArrayList<EdmParameter>(parameters.size());
|
||||
for (CommonParameter parameter : parameters) {
|
||||
_parameters.add(EdmParameterImpl.getInstance(instance.edm, parameter));
|
||||
_parameters.add(new EdmParameterImpl(instance.edm, parameter));
|
||||
}
|
||||
instance.setParameters(_parameters);
|
||||
|
||||
|
@ -74,4 +77,9 @@ public class EdmOperationProxy extends AbstractEdmOperation {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EdmAnnotation> getAnnotations() {
|
||||
return Collections.<EdmAnnotation>emptyList();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -43,8 +43,8 @@ public class EdmServiceMetadataImpl extends AbstractEdmServiceMetadataImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getDataServiceVersion() {
|
||||
return SERVICE_VERSION.toString();
|
||||
public ODataServiceVersion getDataServiceVersion() {
|
||||
return SERVICE_VERSION;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -48,8 +48,8 @@ public class EdmServiceMetadataImpl extends AbstractEdmServiceMetadataImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getDataServiceVersion() {
|
||||
return SERVICE_VERSION.toString();
|
||||
public ODataServiceVersion getDataServiceVersion() {
|
||||
return SERVICE_VERSION;
|
||||
}
|
||||
|
||||
@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 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;
|
||||
|
||||
public abstract class AbstractEdmDeserializer<T> extends JsonDeserializer<T> {
|
||||
|
@ -35,12 +35,12 @@ public abstract class AbstractEdmDeserializer<T> extends JsonDeserializer<T> {
|
|||
protected ODataServiceVersion version;
|
||||
|
||||
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 {
|
||||
final ConstExprConstructImpl constExpr = new ConstExprConstructImpl();
|
||||
constExpr.setType(ConstExprConstructImpl.Type.fromString(jp.getCurrentName()));
|
||||
protected ConstantAnnotationExpressionImpl parseAnnotationConstExprConstruct(final JsonParser jp) throws IOException {
|
||||
final ConstantAnnotationExpressionImpl constExpr = new ConstantAnnotationExpressionImpl();
|
||||
constExpr.setType(ConstantAnnotationExpressionImpl.Type.fromString(jp.getCurrentName()));
|
||||
constExpr.setValue(jp.nextTextValue());
|
||||
return constExpr;
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.apache.olingo.client.core.edm.xml;
|
|||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
|
||||
import org.apache.olingo.client.api.edm.xml.CommonProperty;
|
||||
import org.apache.olingo.commons.api.edm.geo.SRID;
|
||||
|
||||
@JsonDeserialize(using = PropertyDeserializer.class)
|
||||
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 String srid;
|
||||
private SRID srid;
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
|
@ -118,11 +119,11 @@ public abstract class AbstractProperty extends AbstractEdmItem implements Common
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getSrid() {
|
||||
public SRID getSrid() {
|
||||
return srid;
|
||||
}
|
||||
|
||||
public void setSrid(final String srid) {
|
||||
public void setSrid(final 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));
|
||||
} else if ("Annotation".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
((org.apache.olingo.client.core.edm.xml.v4.ComplexTypeImpl) complexType).
|
||||
setAnnotation(jp.readValueAs(AnnotationImpl.class));
|
||||
((org.apache.olingo.client.core.edm.xml.v4.ComplexTypeImpl) complexType).getAnnotations().
|
||||
add(jp.readValueAs(AnnotationImpl.class));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,8 +90,8 @@ public class EntityContainerDeserializer extends AbstractEdmDeserializer<Abstrac
|
|||
}
|
||||
} else if ("Annotation".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
((org.apache.olingo.client.core.edm.xml.v4.EntityContainerImpl) entityContainer).
|
||||
setAnnotation(jp.readValueAs(AnnotationImpl.class));
|
||||
((org.apache.olingo.client.core.edm.xml.v4.EntityContainerImpl) entityContainer).getAnnotations().
|
||||
add(jp.readValueAs(AnnotationImpl.class));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,8 +57,8 @@ public class EntitySetDeserializer extends AbstractEdmDeserializer<AbstractEntit
|
|||
jp.readValueAs(NavigationPropertyBindingImpl.class));
|
||||
} else if ("Annotation".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
((org.apache.olingo.client.core.edm.xml.v4.EntitySetImpl) entitySet).
|
||||
setAnnotation(jp.readValueAs(AnnotationImpl.class));
|
||||
((org.apache.olingo.client.core.edm.xml.v4.EntitySetImpl) entitySet).getAnnotations().
|
||||
add(jp.readValueAs(AnnotationImpl.class));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,12 +59,10 @@ public class EntityTypeDeserializer extends AbstractEdmDeserializer<AbstractEnti
|
|||
jp.nextToken();
|
||||
if (entityType instanceof org.apache.olingo.client.core.edm.xml.v3.EntityTypeImpl) {
|
||||
((org.apache.olingo.client.core.edm.xml.v3.EntityTypeImpl) entityType).
|
||||
getProperties().add(jp.readValueAs(
|
||||
org.apache.olingo.client.core.edm.xml.v3.PropertyImpl.class));
|
||||
getProperties().add(jp.readValueAs(org.apache.olingo.client.core.edm.xml.v3.PropertyImpl.class));
|
||||
} else {
|
||||
((org.apache.olingo.client.core.edm.xml.v4.EntityTypeImpl) entityType).
|
||||
getProperties().add(jp.readValueAs(
|
||||
org.apache.olingo.client.core.edm.xml.v4.PropertyImpl.class));
|
||||
getProperties().add(jp.readValueAs(org.apache.olingo.client.core.edm.xml.v4.PropertyImpl.class));
|
||||
}
|
||||
} else if ("NavigationProperty".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
|
@ -79,8 +77,8 @@ public class EntityTypeDeserializer extends AbstractEdmDeserializer<AbstractEnti
|
|||
}
|
||||
} else if ("Annotation".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
((org.apache.olingo.client.core.edm.xml.v4.EntityTypeImpl) entityType).
|
||||
setAnnotation(jp.readValueAs(AnnotationImpl.class));
|
||||
((org.apache.olingo.client.core.edm.xml.v4.EntityTypeImpl) entityType).getAnnotations().
|
||||
add(jp.readValueAs(AnnotationImpl.class));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,8 +61,8 @@ public class EnumTypeDeserializer extends AbstractEdmDeserializer<AbstractEnumTy
|
|||
}
|
||||
} else if ("Annotation".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
((org.apache.olingo.client.core.edm.xml.v4.EnumTypeImpl) enumType).
|
||||
setAnnotation(jp.readValueAs(AnnotationImpl.class));
|
||||
((org.apache.olingo.client.core.edm.xml.v4.EnumTypeImpl) enumType).getAnnotations().
|
||||
add(jp.readValueAs(AnnotationImpl.class));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,9 @@ import java.io.IOException;
|
|||
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
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.geo.SRID;
|
||||
|
||||
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).
|
||||
setMode(ParameterMode.valueOf(jp.nextTextValue()));
|
||||
} 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.JsonToken;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import org.apache.olingo.commons.api.edm.geo.SRID;
|
||||
|
||||
public class PropertyDeserializer extends AbstractEdmDeserializer<AbstractProperty> {
|
||||
|
||||
|
@ -74,7 +75,10 @@ public class PropertyDeserializer extends AbstractEdmDeserializer<AbstractProper
|
|||
setCollation(jp.nextTextValue());
|
||||
}
|
||||
} 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())) {
|
||||
if (property instanceof org.apache.olingo.client.core.edm.xml.v3.PropertyImpl) {
|
||||
((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()));
|
||||
}
|
||||
} else if ("Annotation".equals(jp.getCurrentName())) {
|
||||
((org.apache.olingo.client.core.edm.xml.v4.PropertyImpl) property).
|
||||
setAnnotation(jp.readValueAs(AnnotationImpl.class));
|
||||
jp.nextToken();
|
||||
((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));
|
||||
} else {
|
||||
org.apache.olingo.client.core.edm.xml.v4.EntityContainerImpl entityContainer =
|
||||
jp.readValueAs(
|
||||
jp.readValueAs(
|
||||
org.apache.olingo.client.core.edm.xml.v4.EntityContainerImpl.class);
|
||||
entityContainer.setDefaultEntityContainer(true);
|
||||
((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())) {
|
||||
jp.nextToken();
|
||||
if (schema instanceof org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) {
|
||||
((org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) schema).getAnnotationsList().
|
||||
add(jp.readValueAs(
|
||||
org.apache.olingo.client.core.edm.xml.v3.AnnotationsImpl.class));
|
||||
((org.apache.olingo.client.core.edm.xml.v3.SchemaImpl) schema).getAnnotationGroups().
|
||||
add(jp.readValueAs(org.apache.olingo.client.core.edm.xml.v3.AnnotationsImpl.class));
|
||||
} else {
|
||||
((org.apache.olingo.client.core.edm.xml.v4.SchemaImpl) schema).getAnnotationsList().
|
||||
add(jp.readValueAs(
|
||||
org.apache.olingo.client.core.edm.xml.v4.AnnotationsImpl.class));
|
||||
((org.apache.olingo.client.core.edm.xml.v4.SchemaImpl) schema).getAnnotationGroups().
|
||||
add(jp.readValueAs(org.apache.olingo.client.core.edm.xml.v4.AnnotationsImpl.class));
|
||||
}
|
||||
} else if ("Action".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
|
|
|
@ -16,10 +16,11 @@
|
|||
* specific language governing permissions and limitations
|
||||
* 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.v4.ReturnType;
|
||||
import org.apache.olingo.commons.api.edm.geo.SRID;
|
||||
|
||||
public class ReturnTypeProxy implements ReturnType {
|
||||
|
||||
|
@ -45,7 +46,7 @@ public class ReturnTypeProxy implements ReturnType {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getSrid() {
|
||||
public SRID getSrid() {
|
||||
return null;
|
||||
}
|
||||
|
|
@ -57,14 +57,14 @@ public class SchemaImpl extends AbstractSchema implements Schema {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<Annotations> getAnnotationsList() {
|
||||
public List<Annotations> getAnnotationGroups() {
|
||||
return annotationList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Annotations getAnnotationsList(final String target) {
|
||||
public Annotations getAnnotationGroup(final String target) {
|
||||
Annotations result = null;
|
||||
for (Annotations annots : getAnnotationsList()) {
|
||||
for (Annotations annots : getAnnotationGroups()) {
|
||||
if (target.equals(annots.getTarget())) {
|
||||
result = annots;
|
||||
}
|
||||
|
|
|
@ -18,28 +18,22 @@
|
|||
*/
|
||||
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.core.edm.xml.AbstractEdmItem;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import java.util.ArrayList;
|
||||
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;
|
||||
|
||||
@JsonProperty("Annotation")
|
||||
private AnnotationImpl annotation;
|
||||
private final List<Annotation> annotations = new ArrayList<Annotation>();
|
||||
|
||||
@Override
|
||||
public AnnotationImpl getAnnotation() {
|
||||
return annotation;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public void setAnnotation(final Annotation annotation) {
|
||||
this.annotation = (AnnotationImpl) annotation;
|
||||
public List<Annotation> getAnnotations() {
|
||||
return annotations;
|
||||
}
|
||||
|
||||
}
|
|
@ -52,7 +52,7 @@ public class ActionDeserializer extends AbstractEdmDeserializer<ActionImpl> {
|
|||
action.setReturnType(parseReturnType(jp, "Action"));
|
||||
} else if ("Annotation".equals(jp.getCurrentName())) {
|
||||
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;
|
||||
|
||||
@JsonDeserialize(using = ActionDeserializer.class)
|
||||
public class ActionImpl extends AbstractAnnotatedEdmItem implements Action {
|
||||
public class ActionImpl extends AbstractAnnotatable implements Action {
|
||||
|
||||
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;
|
||||
|
||||
public class ActionImportImpl extends AbstractAnnotatedEdmItem implements ActionImport {
|
||||
public class ActionImportImpl extends AbstractAnnotatable implements ActionImport {
|
||||
|
||||
private static final long serialVersionUID = -866422101558426421L;
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ import com.fasterxml.jackson.databind.DeserializationContext;
|
|||
|
||||
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;
|
||||
|
||||
public class AnnotationDeserializer extends AbstractEdmDeserializer<AnnotationImpl> {
|
||||
|
@ -43,12 +43,15 @@ public class AnnotationDeserializer extends AbstractEdmDeserializer<AnnotationIm
|
|||
annotation.setTerm(jp.nextTextValue());
|
||||
} else if ("Qualifier".equals(jp.getCurrentName())) {
|
||||
annotation.setQualifier(jp.nextTextValue());
|
||||
} else if ("Annotation".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
annotation.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
|
||||
} else if (isAnnotationConstExprConstruct(jp)) {
|
||||
// Constant Expressions
|
||||
annotation.setConstExpr(parseAnnotationConstExprConstruct(jp));
|
||||
annotation.setAnnotationExpression(parseAnnotationConstExprConstruct(jp));
|
||||
} else {
|
||||
// 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