mirror of
https://github.com/apache/olingo-odata4.git
synced 2025-02-21 17:41:10 +00:00
[OLINGO-575] More Tests and refactoring of JSON deserializer
This commit is contained in:
parent
2fa997a8f1
commit
7ef2d2de4f
@ -23,15 +23,12 @@ import java.io.IOException;
|
||||
import org.apache.olingo.client.core.edm.xml.annotation.ConstantAnnotationExpressionImpl;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import com.fasterxml.jackson.databind.JsonDeserializer;
|
||||
import com.fasterxml.jackson.dataformat.xml.deser.FromXmlParser;
|
||||
|
||||
public abstract class AbstractEdmDeserializer<T> extends JsonDeserializer<T> {
|
||||
|
||||
//protected ODataServiceVersion version;
|
||||
|
||||
protected boolean isAnnotationConstExprConstruct(final JsonParser jp) throws IOException {
|
||||
return ConstantAnnotationExpressionImpl.Type.fromString(jp.getCurrentName()) != null;
|
||||
}
|
||||
@ -44,7 +41,7 @@ public abstract class AbstractEdmDeserializer<T> extends JsonDeserializer<T> {
|
||||
}
|
||||
|
||||
protected ReturnTypeImpl parseReturnType(final JsonParser jp, final String elementName) throws IOException {
|
||||
ReturnTypeImpl returnType;
|
||||
final ReturnTypeImpl returnType;
|
||||
if (elementName.equals(((FromXmlParser) jp).getStaxReader().getLocalName())) {
|
||||
returnType = new ReturnTypeImpl();
|
||||
returnType.setType(jp.nextTextValue());
|
||||
@ -55,15 +52,10 @@ public abstract class AbstractEdmDeserializer<T> extends JsonDeserializer<T> {
|
||||
return returnType;
|
||||
}
|
||||
|
||||
protected abstract T doDeserialize(JsonParser jp, DeserializationContext ctxt)
|
||||
throws IOException, JsonProcessingException;
|
||||
protected abstract T doDeserialize(JsonParser jp, DeserializationContext ctxt) throws IOException;
|
||||
|
||||
@Override
|
||||
public T deserialize(final JsonParser jp, final DeserializationContext ctxt)
|
||||
throws IOException, JsonProcessingException {
|
||||
|
||||
//version = (ODataServiceVersion) ctxt.findInjectableValue(ODataServiceVersion.class.getName(), null, null);
|
||||
public T deserialize(final JsonParser jp, final DeserializationContext ctxt) throws IOException {
|
||||
return doDeserialize(jp, ctxt);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,64 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.client.core.edm.xml;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
|
||||
public class EntityContainerDeserializer extends AbstractEdmDeserializer<EntityContainerImpl> {
|
||||
|
||||
@Override
|
||||
protected EntityContainerImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
|
||||
throws IOException, JsonProcessingException {
|
||||
|
||||
final EntityContainerImpl entityContainer = new EntityContainerImpl();
|
||||
|
||||
for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
|
||||
final JsonToken token = jp.getCurrentToken();
|
||||
if (token == JsonToken.FIELD_NAME) {
|
||||
if ("Name".equals(jp.getCurrentName())) {
|
||||
entityContainer.setName(jp.nextTextValue());
|
||||
} else if ("Extends".equals(jp.getCurrentName())) {
|
||||
entityContainer.setExtendsContainer(jp.nextTextValue());
|
||||
} else if ("EntitySet".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
entityContainer.getEntitySets().add(jp.readValueAs(EntitySetImpl.class));
|
||||
} else if ("Singleton".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
entityContainer.getSingletons().add(jp.readValueAs(SingletonImpl.class));
|
||||
} else if ("ActionImport".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
entityContainer.getActionImports().add(jp.readValueAs(ActionImportImpl.class));
|
||||
} else if ("FunctionImport".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
entityContainer.getFunctionImports().add(jp.readValueAs(FunctionImportImpl.class));
|
||||
} else if ("Annotation".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
entityContainer.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return entityContainer;
|
||||
}
|
||||
}
|
@ -18,12 +18,55 @@
|
||||
*/
|
||||
package org.apache.olingo.client.core.edm.xml;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import org.apache.olingo.commons.api.edm.provider.EntityContainer;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
|
||||
@JsonDeserialize(using = EntityContainerDeserializer.class)
|
||||
import java.io.IOException;
|
||||
|
||||
@JsonDeserialize(using = EntityContainerImpl.EntityContainerDeserializer.class)
|
||||
public class EntityContainerImpl extends EntityContainer {
|
||||
|
||||
private static final long serialVersionUID = 5631432527646955795L;
|
||||
|
||||
static class EntityContainerDeserializer extends AbstractEdmDeserializer<EntityContainerImpl> {
|
||||
|
||||
@Override
|
||||
protected EntityContainerImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
|
||||
throws IOException {
|
||||
|
||||
final EntityContainerImpl entityContainer = new EntityContainerImpl();
|
||||
|
||||
for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
|
||||
final JsonToken token = jp.getCurrentToken();
|
||||
if (token == JsonToken.FIELD_NAME) {
|
||||
if ("Name".equals(jp.getCurrentName())) {
|
||||
entityContainer.setName(jp.nextTextValue());
|
||||
} else if ("Extends".equals(jp.getCurrentName())) {
|
||||
entityContainer.setExtendsContainer(jp.nextTextValue());
|
||||
} else if ("EntitySet".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
entityContainer.getEntitySets().add(jp.readValueAs(EntitySetImpl.class));
|
||||
} else if ("Singleton".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
entityContainer.getSingletons().add(jp.readValueAs(SingletonImpl.class));
|
||||
} else if ("ActionImport".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
entityContainer.getActionImports().add(jp.readValueAs(ActionImportImpl.class));
|
||||
} else if ("FunctionImport".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
entityContainer.getFunctionImports().add(jp.readValueAs(FunctionImportImpl.class));
|
||||
} else if ("Annotation".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
entityContainer.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return entityContainer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.client.core.edm.xml;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
|
||||
public class EntityKeyDeserializer extends AbstractEdmDeserializer<EntityKeyImpl> {
|
||||
|
||||
@Override
|
||||
protected EntityKeyImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
|
||||
throws IOException, JsonProcessingException {
|
||||
|
||||
final EntityKeyImpl entityKey = new EntityKeyImpl();
|
||||
|
||||
for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
|
||||
final JsonToken token = jp.getCurrentToken();
|
||||
|
||||
if (token == JsonToken.FIELD_NAME && "PropertyRef".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
entityKey.getPropertyRefs().add(jp.readValueAs(PropertyRefImpl.class));
|
||||
}
|
||||
}
|
||||
|
||||
return entityKey;
|
||||
}
|
||||
}
|
@ -18,15 +18,19 @@
|
||||
*/
|
||||
package org.apache.olingo.client.core.edm.xml;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import org.apache.olingo.commons.api.edm.provider.AbstractEdmItem;
|
||||
import org.apache.olingo.commons.api.edm.provider.PropertyRef;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
|
||||
@JsonDeserialize(using = EntityKeyDeserializer.class)
|
||||
@JsonDeserialize(using = EntityKeyImpl.EntityKeyDeserializer.class)
|
||||
public class EntityKeyImpl extends AbstractEdmItem {
|
||||
|
||||
private static final long serialVersionUID = 520227585458843347L;
|
||||
@ -36,4 +40,24 @@ public class EntityKeyImpl extends AbstractEdmItem {
|
||||
public List<PropertyRef> getPropertyRefs() {
|
||||
return propertyRefs;
|
||||
}
|
||||
|
||||
static class EntityKeyDeserializer extends AbstractEdmDeserializer<EntityKeyImpl> {
|
||||
@Override
|
||||
protected EntityKeyImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
|
||||
throws IOException {
|
||||
|
||||
final EntityKeyImpl entityKey = new EntityKeyImpl();
|
||||
|
||||
for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
|
||||
final JsonToken token = jp.getCurrentToken();
|
||||
|
||||
if (token == JsonToken.FIELD_NAME && "PropertyRef".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
entityKey.getPropertyRefs().add(jp.readValueAs(PropertyRefImpl.class));
|
||||
}
|
||||
}
|
||||
|
||||
return entityKey;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,61 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.client.core.edm.xml;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.olingo.commons.api.edm.provider.EntitySet;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
|
||||
public class EntitySetDeserializer extends AbstractEdmDeserializer<EntitySet> {
|
||||
|
||||
@Override
|
||||
protected EntitySet doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
|
||||
throws IOException, JsonProcessingException {
|
||||
|
||||
final EntitySetImpl entitySet = new EntitySetImpl();
|
||||
|
||||
for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
|
||||
final JsonToken token = jp.getCurrentToken();
|
||||
if (token == JsonToken.FIELD_NAME) {
|
||||
if ("Name".equals(jp.getCurrentName())) {
|
||||
entitySet.setName(jp.nextTextValue());
|
||||
} else if ("EntityType".equals(jp.getCurrentName())) {
|
||||
entitySet.setType(jp.nextTextValue());
|
||||
} else if ("IncludeInServiceDocument".equals(jp.getCurrentName())) {
|
||||
entitySet.setIncludeInServiceDocument(BooleanUtils.toBoolean(jp.nextTextValue()));
|
||||
} else if ("NavigationPropertyBinding".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
entitySet.getNavigationPropertyBindings().add(jp.readValueAs(NavigationPropertyBindingImpl.class));
|
||||
} else if ("Annotation".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
entitySet.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return entitySet;
|
||||
}
|
||||
|
||||
}
|
@ -18,13 +18,48 @@
|
||||
*/
|
||||
package org.apache.olingo.client.core.edm.xml;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.olingo.commons.api.edm.provider.EntitySet;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
|
||||
@JsonDeserialize(using = EntitySetDeserializer.class)
|
||||
import java.io.IOException;
|
||||
|
||||
@JsonDeserialize(using = EntitySetImpl.EntitySetDeserializer.class)
|
||||
public class EntitySetImpl extends EntitySet {
|
||||
|
||||
private static final long serialVersionUID = -5553885465204370676L;
|
||||
|
||||
static class EntitySetDeserializer extends AbstractEdmDeserializer<EntitySet> {
|
||||
@Override
|
||||
protected EntitySet doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
|
||||
throws IOException {
|
||||
|
||||
final EntitySetImpl entitySet = new EntitySetImpl();
|
||||
|
||||
for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
|
||||
final JsonToken token = jp.getCurrentToken();
|
||||
if (token == JsonToken.FIELD_NAME) {
|
||||
if ("Name".equals(jp.getCurrentName())) {
|
||||
entitySet.setName(jp.nextTextValue());
|
||||
} else if ("EntityType".equals(jp.getCurrentName())) {
|
||||
entitySet.setType(jp.nextTextValue());
|
||||
} else if ("IncludeInServiceDocument".equals(jp.getCurrentName())) {
|
||||
entitySet.setIncludeInServiceDocument(BooleanUtils.toBoolean(jp.nextTextValue()));
|
||||
} else if ("NavigationPropertyBinding".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
entitySet.getNavigationPropertyBindings().add(jp.readValueAs(NavigationPropertyBindingImpl.class));
|
||||
} else if ("Annotation".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
entitySet.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return entitySet;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,71 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.client.core.edm.xml;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.olingo.commons.api.edm.provider.EntityType;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
|
||||
public class EntityTypeDeserializer extends AbstractEdmDeserializer<EntityType> {
|
||||
|
||||
@Override
|
||||
protected EntityType doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
|
||||
throws IOException, JsonProcessingException {
|
||||
|
||||
final EntityTypeImpl entityType = new EntityTypeImpl();
|
||||
|
||||
for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
|
||||
final JsonToken token = jp.getCurrentToken();
|
||||
if (token == JsonToken.FIELD_NAME) {
|
||||
if ("Name".equals(jp.getCurrentName())) {
|
||||
entityType.setName(jp.nextTextValue());
|
||||
} else if ("Abstract".equals(jp.getCurrentName())) {
|
||||
entityType.setAbstract(BooleanUtils.toBoolean(jp.nextTextValue()));
|
||||
} else if ("BaseType".equals(jp.getCurrentName())) {
|
||||
entityType.setBaseType(jp.nextTextValue());
|
||||
} else if ("OpenType".equals(jp.getCurrentName())) {
|
||||
entityType.setOpenType(BooleanUtils.toBoolean(jp.nextTextValue()));
|
||||
} else if ("HasStream".equals(jp.getCurrentName())) {
|
||||
entityType.setHasStream(BooleanUtils.toBoolean(jp.nextTextValue()));
|
||||
} else if ("Key".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
EntityKeyImpl keyImpl = jp.readValueAs(EntityKeyImpl.class);
|
||||
entityType.setKey(keyImpl.getPropertyRefs());
|
||||
} else if ("Property".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
entityType.getProperties().add(jp.readValueAs(PropertyImpl.class));
|
||||
} else if ("NavigationProperty".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
entityType.getNavigationProperties().add(jp.readValueAs(NavigationPropertyImpl.class));
|
||||
} else if ("Annotation".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
entityType.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return entityType;
|
||||
}
|
||||
}
|
@ -18,12 +18,59 @@
|
||||
*/
|
||||
package org.apache.olingo.client.core.edm.xml;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.olingo.commons.api.edm.provider.EntityType;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
|
||||
@JsonDeserialize(using = EntityTypeDeserializer.class)
|
||||
import java.io.IOException;
|
||||
|
||||
@JsonDeserialize(using = EntityTypeImpl.EntityTypeDeserializer.class)
|
||||
public class EntityTypeImpl extends EntityType {
|
||||
|
||||
private static final long serialVersionUID = -3986417775876689669L;
|
||||
|
||||
static class EntityTypeDeserializer extends AbstractEdmDeserializer<EntityType> {
|
||||
@Override
|
||||
protected EntityType doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
|
||||
throws IOException {
|
||||
|
||||
final EntityTypeImpl entityType = new EntityTypeImpl();
|
||||
|
||||
for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
|
||||
final JsonToken token = jp.getCurrentToken();
|
||||
if (token == JsonToken.FIELD_NAME) {
|
||||
if ("Name".equals(jp.getCurrentName())) {
|
||||
entityType.setName(jp.nextTextValue());
|
||||
} else if ("Abstract".equals(jp.getCurrentName())) {
|
||||
entityType.setAbstract(BooleanUtils.toBoolean(jp.nextTextValue()));
|
||||
} else if ("BaseType".equals(jp.getCurrentName())) {
|
||||
entityType.setBaseType(jp.nextTextValue());
|
||||
} else if ("OpenType".equals(jp.getCurrentName())) {
|
||||
entityType.setOpenType(BooleanUtils.toBoolean(jp.nextTextValue()));
|
||||
} else if ("HasStream".equals(jp.getCurrentName())) {
|
||||
entityType.setHasStream(BooleanUtils.toBoolean(jp.nextTextValue()));
|
||||
} else if ("Key".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
EntityKeyImpl keyImpl = jp.readValueAs(EntityKeyImpl.class);
|
||||
entityType.setKey(keyImpl.getPropertyRefs());
|
||||
} else if ("Property".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
entityType.getProperties().add(jp.readValueAs(PropertyImpl.class));
|
||||
} else if ("NavigationProperty".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
entityType.getNavigationProperties().add(jp.readValueAs(NavigationPropertyImpl.class));
|
||||
} else if ("Annotation".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
entityType.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return entityType;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,59 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.client.core.edm.xml;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
|
||||
public class EnumTypeDeserializer extends AbstractEdmDeserializer<EnumTypeImpl> {
|
||||
|
||||
@Override
|
||||
protected EnumTypeImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
|
||||
throws IOException, JsonProcessingException {
|
||||
|
||||
final EnumTypeImpl enumType = new EnumTypeImpl();
|
||||
|
||||
for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
|
||||
final JsonToken token = jp.getCurrentToken();
|
||||
if (token == JsonToken.FIELD_NAME) {
|
||||
if ("Name".equals(jp.getCurrentName())) {
|
||||
enumType.setName(jp.nextTextValue());
|
||||
} else if ("UnderlyingType".equals(jp.getCurrentName())) {
|
||||
enumType.setUnderlyingType(jp.nextTextValue());
|
||||
} else if ("IsFlags".equals(jp.getCurrentName())) {
|
||||
enumType.setFlags(BooleanUtils.toBoolean(jp.nextTextValue()));
|
||||
} else if ("Member".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
enumType.getMembers().add(jp.readValueAs(EnumMemberImpl.class));
|
||||
} else if ("Annotation".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
enumType.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return enumType;
|
||||
}
|
||||
}
|
@ -18,13 +18,48 @@
|
||||
*/
|
||||
package org.apache.olingo.client.core.edm.xml;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.olingo.commons.api.edm.provider.EnumType;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
|
||||
@JsonDeserialize(using = EnumTypeDeserializer.class)
|
||||
import java.io.IOException;
|
||||
|
||||
@JsonDeserialize(using = EnumTypeImpl.EnumTypeDeserializer.class)
|
||||
public class EnumTypeImpl extends EnumType {
|
||||
|
||||
private static final long serialVersionUID = 9191189755592743333L;
|
||||
|
||||
static class EnumTypeDeserializer extends AbstractEdmDeserializer<EnumTypeImpl> {
|
||||
@Override
|
||||
protected EnumTypeImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
|
||||
throws IOException {
|
||||
|
||||
final EnumTypeImpl enumType = new EnumTypeImpl();
|
||||
|
||||
for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
|
||||
final JsonToken token = jp.getCurrentToken();
|
||||
if (token == JsonToken.FIELD_NAME) {
|
||||
if ("Name".equals(jp.getCurrentName())) {
|
||||
enumType.setName(jp.nextTextValue());
|
||||
} else if ("UnderlyingType".equals(jp.getCurrentName())) {
|
||||
enumType.setUnderlyingType(jp.nextTextValue());
|
||||
} else if ("IsFlags".equals(jp.getCurrentName())) {
|
||||
enumType.setFlags(BooleanUtils.toBoolean(jp.nextTextValue()));
|
||||
} else if ("Member".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
enumType.getMembers().add(jp.readValueAs(EnumMemberImpl.class));
|
||||
} else if ("Annotation".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
enumType.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return enumType;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,63 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.client.core.edm.xml;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
|
||||
public class FunctionDeserializer extends AbstractEdmDeserializer<FunctionImpl> {
|
||||
|
||||
@Override
|
||||
protected FunctionImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
|
||||
throws IOException, JsonProcessingException {
|
||||
|
||||
final FunctionImpl functionImpl = new FunctionImpl();
|
||||
|
||||
for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
|
||||
final JsonToken token = jp.getCurrentToken();
|
||||
if (token == JsonToken.FIELD_NAME) {
|
||||
if ("Name".equals(jp.getCurrentName())) {
|
||||
functionImpl.setName(jp.nextTextValue());
|
||||
} else if ("IsBound".equals(jp.getCurrentName())) {
|
||||
functionImpl.setBound(BooleanUtils.toBoolean(jp.nextTextValue()));
|
||||
} else if ("IsComposable".equals(jp.getCurrentName())) {
|
||||
functionImpl.setComposable(BooleanUtils.toBoolean(jp.nextTextValue()));
|
||||
} else if ("EntitySetPath".equals(jp.getCurrentName())) {
|
||||
functionImpl.setEntitySetPath(jp.nextTextValue());
|
||||
} else if ("Parameter".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
functionImpl.getParameters().add(jp.readValueAs(ParameterImpl.class));
|
||||
} else if ("ReturnType".equals(jp.getCurrentName())) {
|
||||
functionImpl.setReturnType(parseReturnType(jp, "Function"));
|
||||
} else if ("Annotation".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
functionImpl.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return functionImpl;
|
||||
}
|
||||
}
|
@ -18,13 +18,52 @@
|
||||
*/
|
||||
package org.apache.olingo.client.core.edm.xml;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.olingo.commons.api.edm.provider.Function;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
|
||||
@JsonDeserialize(using = FunctionDeserializer.class)
|
||||
import java.io.IOException;
|
||||
|
||||
@JsonDeserialize(using = FunctionImpl.FunctionDeserializer.class)
|
||||
public class FunctionImpl extends Function {
|
||||
|
||||
private static final long serialVersionUID = -5494898295282843362L;
|
||||
|
||||
static class FunctionDeserializer extends AbstractEdmDeserializer<FunctionImpl> {
|
||||
@Override
|
||||
protected FunctionImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
|
||||
throws IOException {
|
||||
|
||||
final FunctionImpl functionImpl = new FunctionImpl();
|
||||
|
||||
for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
|
||||
final JsonToken token = jp.getCurrentToken();
|
||||
if (token == JsonToken.FIELD_NAME) {
|
||||
if ("Name".equals(jp.getCurrentName())) {
|
||||
functionImpl.setName(jp.nextTextValue());
|
||||
} else if ("IsBound".equals(jp.getCurrentName())) {
|
||||
functionImpl.setBound(BooleanUtils.toBoolean(jp.nextTextValue()));
|
||||
} else if ("IsComposable".equals(jp.getCurrentName())) {
|
||||
functionImpl.setComposable(BooleanUtils.toBoolean(jp.nextTextValue()));
|
||||
} else if ("EntitySetPath".equals(jp.getCurrentName())) {
|
||||
functionImpl.setEntitySetPath(jp.nextTextValue());
|
||||
} else if ("Parameter".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
functionImpl.getParameters().add(jp.readValueAs(ParameterImpl.class));
|
||||
} else if ("ReturnType".equals(jp.getCurrentName())) {
|
||||
functionImpl.setReturnType(parseReturnType(jp, "Function"));
|
||||
} else if ("Annotation".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
functionImpl.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return functionImpl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,58 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.client.core.edm.xml;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
|
||||
public class FunctionImportDeserializer extends AbstractEdmDeserializer<FunctionImportImpl> {
|
||||
|
||||
@Override
|
||||
protected FunctionImportImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
|
||||
throws IOException, JsonProcessingException {
|
||||
|
||||
final FunctionImportImpl functImpImpl = new FunctionImportImpl();
|
||||
|
||||
for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
|
||||
final JsonToken token = jp.getCurrentToken();
|
||||
if (token == JsonToken.FIELD_NAME) {
|
||||
if ("Name".equals(jp.getCurrentName())) {
|
||||
functImpImpl.setName(jp.nextTextValue());
|
||||
} else if ("Function".equals(jp.getCurrentName())) {
|
||||
functImpImpl.setFunction(jp.nextTextValue());
|
||||
} else if ("EntitySet".equals(jp.getCurrentName())) {
|
||||
functImpImpl.setEntitySet(jp.nextTextValue());
|
||||
} else if ("IncludeInServiceDocument".equals(jp.getCurrentName())) {
|
||||
functImpImpl.setIncludeInServiceDocument(BooleanUtils.toBoolean(jp.nextTextValue()));
|
||||
} else if ("Annotation".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
functImpImpl.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return functImpImpl;
|
||||
}
|
||||
}
|
@ -18,12 +18,47 @@
|
||||
*/
|
||||
package org.apache.olingo.client.core.edm.xml;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.olingo.commons.api.edm.provider.FunctionImport;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
|
||||
@JsonDeserialize(using = FunctionImportDeserializer.class)
|
||||
import java.io.IOException;
|
||||
|
||||
@JsonDeserialize(using = FunctionImportImpl.FunctionImportDeserializer.class)
|
||||
public class FunctionImportImpl extends FunctionImport {
|
||||
|
||||
private static final long serialVersionUID = -1686801084142932402L;
|
||||
|
||||
static class FunctionImportDeserializer extends AbstractEdmDeserializer<FunctionImportImpl> {
|
||||
@Override
|
||||
protected FunctionImportImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
|
||||
throws IOException {
|
||||
|
||||
final FunctionImportImpl functImpImpl = new FunctionImportImpl();
|
||||
|
||||
for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
|
||||
final JsonToken token = jp.getCurrentToken();
|
||||
if (token == JsonToken.FIELD_NAME) {
|
||||
if ("Name".equals(jp.getCurrentName())) {
|
||||
functImpImpl.setName(jp.nextTextValue());
|
||||
} else if ("Function".equals(jp.getCurrentName())) {
|
||||
functImpImpl.setFunction(jp.nextTextValue());
|
||||
} else if ("EntitySet".equals(jp.getCurrentName())) {
|
||||
functImpImpl.setEntitySet(jp.nextTextValue());
|
||||
} else if ("IncludeInServiceDocument".equals(jp.getCurrentName())) {
|
||||
functImpImpl.setIncludeInServiceDocument(BooleanUtils.toBoolean(jp.nextTextValue()));
|
||||
} else if ("Annotation".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
functImpImpl.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return functImpImpl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,79 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.client.core.edm.xml;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.olingo.commons.api.edm.geo.SRID;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
|
||||
public class ParameterDeserializer extends AbstractEdmDeserializer<ParameterImpl> {
|
||||
|
||||
@Override
|
||||
protected ParameterImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
|
||||
throws IOException, JsonProcessingException {
|
||||
|
||||
final ParameterImpl parameter = new ParameterImpl();
|
||||
|
||||
for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
|
||||
final JsonToken token = jp.getCurrentToken();
|
||||
if (token == JsonToken.FIELD_NAME) {
|
||||
if ("Name".equals(jp.getCurrentName())) {
|
||||
parameter.setName(jp.nextTextValue());
|
||||
} else if ("Type".equals(jp.getCurrentName())) {
|
||||
String metadataTypeName = jp.nextTextValue();
|
||||
if (metadataTypeName.startsWith("Collection(")) {
|
||||
parameter.setType(metadataTypeName.substring(metadataTypeName.indexOf("(") + 1,
|
||||
metadataTypeName.length() - 1));
|
||||
parameter.setCollection(true);
|
||||
} else {
|
||||
parameter.setType(metadataTypeName);
|
||||
parameter.setCollection(false);
|
||||
}
|
||||
} else if ("Nullable".equals(jp.getCurrentName())) {
|
||||
parameter.setNullable(BooleanUtils.toBoolean(jp.nextTextValue()));
|
||||
} else if ("MaxLength".equals(jp.getCurrentName())) {
|
||||
final String maxLenght = jp.nextTextValue();
|
||||
parameter.setMaxLength(maxLenght.equalsIgnoreCase("max") ? Integer.MAX_VALUE : Integer.valueOf(maxLenght));
|
||||
} else if ("Precision".equals(jp.getCurrentName())) {
|
||||
parameter.setPrecision(Integer.valueOf(jp.nextTextValue()));
|
||||
} else if ("Scale".equals(jp.getCurrentName())) {
|
||||
final String scale = jp.nextTextValue();
|
||||
parameter.setScale(scale.equalsIgnoreCase("variable") ? 0 : Integer.valueOf(scale));
|
||||
} else if ("SRID".equals(jp.getCurrentName())) {
|
||||
final String srid = jp.nextTextValue();
|
||||
if (srid != null) {
|
||||
parameter.setSrid(SRID.valueOf(srid));
|
||||
}
|
||||
} else if ("Annotation".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
parameter.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return parameter;
|
||||
}
|
||||
|
||||
}
|
@ -18,12 +18,67 @@
|
||||
*/
|
||||
package org.apache.olingo.client.core.edm.xml;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.olingo.commons.api.edm.geo.SRID;
|
||||
import org.apache.olingo.commons.api.edm.provider.Parameter;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
|
||||
@JsonDeserialize(using = ParameterDeserializer.class)
|
||||
import java.io.IOException;
|
||||
|
||||
@JsonDeserialize(using = ParameterImpl.ParameterDeserializer.class)
|
||||
public class ParameterImpl extends Parameter {
|
||||
|
||||
private static final long serialVersionUID = 7119478691341167904L;
|
||||
|
||||
static class ParameterDeserializer extends AbstractEdmDeserializer<ParameterImpl> {
|
||||
@Override
|
||||
protected ParameterImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
|
||||
throws IOException {
|
||||
|
||||
final ParameterImpl parameter = new ParameterImpl();
|
||||
|
||||
for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
|
||||
final JsonToken token = jp.getCurrentToken();
|
||||
if (token == JsonToken.FIELD_NAME) {
|
||||
if ("Name".equals(jp.getCurrentName())) {
|
||||
parameter.setName(jp.nextTextValue());
|
||||
} else if ("Type".equals(jp.getCurrentName())) {
|
||||
String metadataTypeName = jp.nextTextValue();
|
||||
if (metadataTypeName.startsWith("Collection(")) {
|
||||
parameter.setType(metadataTypeName.substring(metadataTypeName.indexOf("(") + 1,
|
||||
metadataTypeName.length() - 1));
|
||||
parameter.setCollection(true);
|
||||
} else {
|
||||
parameter.setType(metadataTypeName);
|
||||
parameter.setCollection(false);
|
||||
}
|
||||
} else if ("Nullable".equals(jp.getCurrentName())) {
|
||||
parameter.setNullable(BooleanUtils.toBoolean(jp.nextTextValue()));
|
||||
} else if ("MaxLength".equals(jp.getCurrentName())) {
|
||||
final String maxLenght = jp.nextTextValue();
|
||||
parameter.setMaxLength(maxLenght.equalsIgnoreCase("max") ? Integer.MAX_VALUE : Integer.valueOf(maxLenght));
|
||||
} else if ("Precision".equals(jp.getCurrentName())) {
|
||||
parameter.setPrecision(Integer.valueOf(jp.nextTextValue()));
|
||||
} else if ("Scale".equals(jp.getCurrentName())) {
|
||||
final String scale = jp.nextTextValue();
|
||||
parameter.setScale(scale.equalsIgnoreCase("variable") ? 0 : Integer.valueOf(scale));
|
||||
} else if ("SRID".equals(jp.getCurrentName())) {
|
||||
final String srid = jp.nextTextValue();
|
||||
if (srid != null) {
|
||||
parameter.setSrid(SRID.valueOf(srid));
|
||||
}
|
||||
} else if ("Annotation".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
parameter.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return parameter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,83 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.client.core.edm.xml;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.olingo.commons.api.edm.geo.SRID;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
|
||||
public class PropertyDeserializer extends AbstractEdmDeserializer<PropertyImpl> {
|
||||
|
||||
@Override
|
||||
protected PropertyImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
|
||||
throws IOException, JsonProcessingException {
|
||||
|
||||
final PropertyImpl property = new org.apache.olingo.client.core.edm.xml.PropertyImpl();
|
||||
|
||||
for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
|
||||
final JsonToken token = jp.getCurrentToken();
|
||||
if (token == JsonToken.FIELD_NAME) {
|
||||
if ("Name".equals(jp.getCurrentName())) {
|
||||
property.setName(jp.nextTextValue());
|
||||
} else if ("Type".equals(jp.getCurrentName())) {
|
||||
String metadataTypeName = jp.nextTextValue();
|
||||
if (metadataTypeName.startsWith("Collection(")) {
|
||||
property.setType(metadataTypeName.substring(metadataTypeName.indexOf("(") + 1,
|
||||
metadataTypeName.length() - 1));
|
||||
property.setCollection(true);
|
||||
} else {
|
||||
property.setType(metadataTypeName);
|
||||
property.setCollection(false);
|
||||
}
|
||||
} else if ("Nullable".equals(jp.getCurrentName())) {
|
||||
property.setNullable(BooleanUtils.toBoolean(jp.nextTextValue()));
|
||||
} else if ("DefaultValue".equals(jp.getCurrentName())) {
|
||||
property.setDefaultValue(jp.nextTextValue());
|
||||
} else if ("MaxLength".equals(jp.getCurrentName())) {
|
||||
final String maxLenght = jp.nextTextValue();
|
||||
property.setMaxLength(maxLenght.equalsIgnoreCase("max") ? Integer.MAX_VALUE : Integer.valueOf(maxLenght));
|
||||
} else if ("Precision".equals(jp.getCurrentName())) {
|
||||
property.setPrecision(Integer.valueOf(jp.nextTextValue()));
|
||||
} else if ("Scale".equals(jp.getCurrentName())) {
|
||||
final String scale = jp.nextTextValue();
|
||||
property.setScale(scale.equalsIgnoreCase("variable") ? 0 : Integer.valueOf(scale));
|
||||
} else if ("Unicode".equals(jp.getCurrentName())) {
|
||||
property.setUnicode(BooleanUtils.toBoolean(jp.nextTextValue()));
|
||||
} else if ("SRID".equals(jp.getCurrentName())) {
|
||||
final String srid = jp.nextTextValue();
|
||||
if (srid != null) {
|
||||
property.setSrid(SRID.valueOf(srid));
|
||||
}
|
||||
} else if ("Annotation".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
property.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return property;
|
||||
}
|
||||
|
||||
}
|
@ -18,13 +18,71 @@
|
||||
*/
|
||||
package org.apache.olingo.client.core.edm.xml;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.olingo.commons.api.edm.geo.SRID;
|
||||
import org.apache.olingo.commons.api.edm.provider.Property;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
|
||||
@JsonDeserialize(using = PropertyDeserializer.class)
|
||||
import java.io.IOException;
|
||||
|
||||
@JsonDeserialize(using = PropertyImpl.PropertyDeserializer.class)
|
||||
public class PropertyImpl extends Property {
|
||||
|
||||
private static final long serialVersionUID = -4521766603286651372L;
|
||||
|
||||
static class PropertyDeserializer extends AbstractEdmDeserializer<PropertyImpl> {
|
||||
@Override
|
||||
protected PropertyImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
|
||||
throws IOException {
|
||||
|
||||
final PropertyImpl property = new org.apache.olingo.client.core.edm.xml.PropertyImpl();
|
||||
|
||||
for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
|
||||
final JsonToken token = jp.getCurrentToken();
|
||||
if (token == JsonToken.FIELD_NAME) {
|
||||
if ("Name".equals(jp.getCurrentName())) {
|
||||
property.setName(jp.nextTextValue());
|
||||
} else if ("Type".equals(jp.getCurrentName())) {
|
||||
String metadataTypeName = jp.nextTextValue();
|
||||
if (metadataTypeName.startsWith("Collection(")) {
|
||||
property.setType(metadataTypeName.substring(metadataTypeName.indexOf("(") + 1,
|
||||
metadataTypeName.length() - 1));
|
||||
property.setCollection(true);
|
||||
} else {
|
||||
property.setType(metadataTypeName);
|
||||
property.setCollection(false);
|
||||
}
|
||||
} else if ("Nullable".equals(jp.getCurrentName())) {
|
||||
property.setNullable(BooleanUtils.toBoolean(jp.nextTextValue()));
|
||||
} else if ("DefaultValue".equals(jp.getCurrentName())) {
|
||||
property.setDefaultValue(jp.nextTextValue());
|
||||
} else if ("MaxLength".equals(jp.getCurrentName())) {
|
||||
final String maxLenght = jp.nextTextValue();
|
||||
property.setMaxLength(maxLenght.equalsIgnoreCase("max") ? Integer.MAX_VALUE : Integer.valueOf(maxLenght));
|
||||
} else if ("Precision".equals(jp.getCurrentName())) {
|
||||
property.setPrecision(Integer.valueOf(jp.nextTextValue()));
|
||||
} else if ("Scale".equals(jp.getCurrentName())) {
|
||||
final String scale = jp.nextTextValue();
|
||||
property.setScale(scale.equalsIgnoreCase("variable") ? 0 : Integer.valueOf(scale));
|
||||
} else if ("Unicode".equals(jp.getCurrentName())) {
|
||||
property.setUnicode(BooleanUtils.toBoolean(jp.nextTextValue()));
|
||||
} else if ("SRID".equals(jp.getCurrentName())) {
|
||||
final String srid = jp.nextTextValue();
|
||||
if (srid != null) {
|
||||
property.setSrid(SRID.valueOf(srid));
|
||||
}
|
||||
} else if ("Annotation".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
property.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return property;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,58 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.client.core.edm.xml;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
|
||||
public class ReferenceDeserializer extends AbstractEdmDeserializer<ReferenceImpl> {
|
||||
|
||||
@Override
|
||||
protected ReferenceImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
|
||||
throws IOException, JsonProcessingException {
|
||||
|
||||
final ReferenceImpl reference = new ReferenceImpl();
|
||||
|
||||
for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
|
||||
final JsonToken token = jp.getCurrentToken();
|
||||
if (token == JsonToken.FIELD_NAME) {
|
||||
if ("Uri".equals(jp.getCurrentName())) {
|
||||
reference.setUri(URI.create(jp.nextTextValue()));
|
||||
} else if ("Include".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
reference.getIncludes().add(jp.readValueAs( IncludeImpl.class));
|
||||
} else if ("IncludeAnnotations".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
reference.getIncludeAnnotations().add(jp.readValueAs( IncludeAnnotationsImpl.class));
|
||||
} else if ("Annotation".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
reference.getAnnotations().add(jp.readValueAs( AnnotationImpl.class));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return reference;
|
||||
}
|
||||
|
||||
}
|
@ -18,10 +18,14 @@
|
||||
*/
|
||||
package org.apache.olingo.client.core.edm.xml;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import org.apache.olingo.client.api.edm.xml.Include;
|
||||
import org.apache.olingo.client.api.edm.xml.IncludeAnnotations;
|
||||
import org.apache.olingo.client.api.edm.xml.Reference;
|
||||
@ -30,17 +34,14 @@ import org.apache.olingo.commons.api.edm.provider.Annotation;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
|
||||
@JsonDeserialize(using = ReferenceDeserializer.class)
|
||||
@JsonDeserialize(using = ReferenceImpl.ReferenceDeserializer.class)
|
||||
public class ReferenceImpl extends AbstractEdmItem implements Reference {
|
||||
|
||||
private static final long serialVersionUID = 7720274712545267654L;
|
||||
|
||||
private URI uri;
|
||||
|
||||
private final List<Include> includes = new ArrayList<Include>();
|
||||
|
||||
private final List<IncludeAnnotations> includeAnnotations = new ArrayList<IncludeAnnotations>();
|
||||
|
||||
private final List<Annotation> annotations = new ArrayList<Annotation>();
|
||||
|
||||
@Override
|
||||
@ -67,4 +68,31 @@ public class ReferenceImpl extends AbstractEdmItem implements Reference {
|
||||
return includeAnnotations;
|
||||
}
|
||||
|
||||
static class ReferenceDeserializer extends AbstractEdmDeserializer<ReferenceImpl> {
|
||||
@Override
|
||||
protected ReferenceImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
|
||||
throws IOException {
|
||||
final ReferenceImpl reference = new ReferenceImpl();
|
||||
|
||||
for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
|
||||
final JsonToken token = jp.getCurrentToken();
|
||||
if (token == JsonToken.FIELD_NAME) {
|
||||
if ("Uri".equals(jp.getCurrentName())) {
|
||||
reference.setUri(URI.create(jp.nextTextValue()));
|
||||
} else if ("Include".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
reference.getIncludes().add(jp.readValueAs( IncludeImpl.class));
|
||||
} else if ("IncludeAnnotations".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
reference.getIncludeAnnotations().add(jp.readValueAs( IncludeAnnotationsImpl.class));
|
||||
} else if ("Annotation".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
reference.getAnnotations().add(jp.readValueAs( AnnotationImpl.class));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return reference;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,74 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.client.core.edm.xml;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.olingo.commons.api.edm.geo.SRID;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
|
||||
public class ReturnTypeDeserializer extends AbstractEdmDeserializer<ReturnTypeImpl> {
|
||||
|
||||
@Override
|
||||
protected ReturnTypeImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
|
||||
throws IOException, JsonProcessingException {
|
||||
|
||||
final ReturnTypeImpl returnType = new ReturnTypeImpl();
|
||||
|
||||
for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
|
||||
final JsonToken token = jp.getCurrentToken();
|
||||
if (token == JsonToken.FIELD_NAME) {
|
||||
if ("Type".equals(jp.getCurrentName())) {
|
||||
String metadataTypeName = jp.nextTextValue();
|
||||
if (metadataTypeName.startsWith("Collection(")) {
|
||||
returnType.setType(metadataTypeName.substring(metadataTypeName.indexOf("(") + 1,
|
||||
metadataTypeName.length() - 1));
|
||||
returnType.setCollection(true);
|
||||
} else {
|
||||
returnType.setType(metadataTypeName);
|
||||
returnType.setCollection(false);
|
||||
}
|
||||
} else if ("Nullable".equals(jp.getCurrentName())) {
|
||||
returnType.setNullable(BooleanUtils.toBoolean(jp.nextTextValue()));
|
||||
} else if ("MaxLength".equals(jp.getCurrentName())) {
|
||||
final String maxLenght = jp.nextTextValue();
|
||||
returnType.setMaxLength(maxLenght.equalsIgnoreCase("max") ? Integer.MAX_VALUE : Integer.valueOf(maxLenght));
|
||||
} else if ("Precision".equals(jp.getCurrentName())) {
|
||||
returnType.setPrecision(Integer.valueOf(jp.nextTextValue()));
|
||||
} else if ("Scale".equals(jp.getCurrentName())) {
|
||||
final String scale = jp.nextTextValue();
|
||||
returnType.setScale(scale.equalsIgnoreCase("variable") ? 0 : Integer.valueOf(scale));
|
||||
} else if ("SRID".equals(jp.getCurrentName())) {
|
||||
final String srid = jp.nextTextValue();
|
||||
if (srid != null) {
|
||||
returnType.setSrid(SRID.valueOf(srid));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return returnType;
|
||||
}
|
||||
|
||||
}
|
@ -18,12 +18,61 @@
|
||||
*/
|
||||
package org.apache.olingo.client.core.edm.xml;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.olingo.commons.api.edm.geo.SRID;
|
||||
import org.apache.olingo.commons.api.edm.provider.ReturnType;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
|
||||
@JsonDeserialize(using = ReturnTypeDeserializer.class)
|
||||
import java.io.IOException;
|
||||
|
||||
@JsonDeserialize(using = ReturnTypeImpl.ReturnTypeDeserializer.class)
|
||||
public class ReturnTypeImpl extends ReturnType {
|
||||
|
||||
private static final long serialVersionUID = 6261092793901735110L;
|
||||
|
||||
static class ReturnTypeDeserializer extends AbstractEdmDeserializer<ReturnTypeImpl> {
|
||||
@Override
|
||||
protected ReturnTypeImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
|
||||
throws IOException {
|
||||
final ReturnTypeImpl returnType = new ReturnTypeImpl();
|
||||
|
||||
for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
|
||||
final JsonToken token = jp.getCurrentToken();
|
||||
if (token == JsonToken.FIELD_NAME) {
|
||||
if ("Type".equals(jp.getCurrentName())) {
|
||||
String metadataTypeName = jp.nextTextValue();
|
||||
if (metadataTypeName.startsWith("Collection(")) {
|
||||
returnType.setType(metadataTypeName.substring(metadataTypeName.indexOf("(") + 1,
|
||||
metadataTypeName.length() - 1));
|
||||
returnType.setCollection(true);
|
||||
} else {
|
||||
returnType.setType(metadataTypeName);
|
||||
returnType.setCollection(false);
|
||||
}
|
||||
} else if ("Nullable".equals(jp.getCurrentName())) {
|
||||
returnType.setNullable(BooleanUtils.toBoolean(jp.nextTextValue()));
|
||||
} else if ("MaxLength".equals(jp.getCurrentName())) {
|
||||
final String maxLenght = jp.nextTextValue();
|
||||
returnType.setMaxLength(maxLenght.equalsIgnoreCase("max") ? Integer.MAX_VALUE : Integer.valueOf(maxLenght));
|
||||
} else if ("Precision".equals(jp.getCurrentName())) {
|
||||
returnType.setPrecision(Integer.valueOf(jp.nextTextValue()));
|
||||
} else if ("Scale".equals(jp.getCurrentName())) {
|
||||
final String scale = jp.nextTextValue();
|
||||
returnType.setScale(scale.equalsIgnoreCase("variable") ? 0 : Integer.valueOf(scale));
|
||||
} else if ("SRID".equals(jp.getCurrentName())) {
|
||||
final String srid = jp.nextTextValue();
|
||||
if (srid != null) {
|
||||
returnType.setSrid(SRID.valueOf(srid));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return returnType;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,80 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.client.core.edm.xml;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
|
||||
public class SchemaDeserializer extends AbstractEdmDeserializer<SchemaImpl> {
|
||||
|
||||
@Override
|
||||
protected SchemaImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
|
||||
throws IOException, JsonProcessingException {
|
||||
|
||||
final SchemaImpl schema = new SchemaImpl();
|
||||
|
||||
for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
|
||||
final JsonToken token = jp.getCurrentToken();
|
||||
if (token == JsonToken.FIELD_NAME) {
|
||||
if ("Namespace".equals(jp.getCurrentName())) {
|
||||
schema.setNamespace(jp.nextTextValue());
|
||||
} else if ("Alias".equals(jp.getCurrentName())) {
|
||||
schema.setAlias(jp.nextTextValue());
|
||||
} else if ("ComplexType".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
schema.getComplexTypes().add(jp.readValueAs(ComplexTypeImpl.class));
|
||||
} else if ("EntityType".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
schema.getEntityTypes().add(jp.readValueAs(EntityTypeImpl.class));
|
||||
} else if ("EnumType".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
schema.getEnumTypes().add(jp.readValueAs(EnumTypeImpl.class));
|
||||
} else if ("EntityContainer".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
EntityContainerImpl entityContainer = jp.readValueAs(EntityContainerImpl.class);
|
||||
schema.setEntityContainer(entityContainer);
|
||||
} else if ("Action".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
schema.getActions().add(jp.readValueAs(ActionImpl.class));
|
||||
} else if ("Function".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
schema.getFunctions().add(jp.readValueAs(FunctionImpl.class));
|
||||
} else if ("TypeDefinition".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
schema.getTypeDefinitions().add(jp.readValueAs(TypeDefinitionImpl.class));
|
||||
}
|
||||
} else if ("Annotations".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
schema.getAnnotationGroups().add(jp.readValueAs(AnnotationsImpl.class));
|
||||
} else if ("Annotation".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
schema.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
|
||||
} else if ("Term".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
schema.getTerms().add(jp.readValueAs(TermImpl.class));
|
||||
}
|
||||
}
|
||||
|
||||
return schema;
|
||||
}
|
||||
}
|
@ -18,13 +18,69 @@
|
||||
*/
|
||||
package org.apache.olingo.client.core.edm.xml;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import org.apache.olingo.commons.api.edm.provider.Schema;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
|
||||
@JsonDeserialize(using = SchemaDeserializer.class)
|
||||
import java.io.IOException;
|
||||
|
||||
@JsonDeserialize(using = SchemaImpl.SchemaDeserializer.class)
|
||||
public class SchemaImpl extends Schema {
|
||||
|
||||
private static final long serialVersionUID = 1911087363912024939L;
|
||||
|
||||
static class SchemaDeserializer extends AbstractEdmDeserializer<SchemaImpl> {
|
||||
@Override
|
||||
protected SchemaImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
|
||||
throws IOException {
|
||||
final SchemaImpl schema = new SchemaImpl();
|
||||
|
||||
for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
|
||||
final JsonToken token = jp.getCurrentToken();
|
||||
if (token == JsonToken.FIELD_NAME) {
|
||||
if ("Namespace".equals(jp.getCurrentName())) {
|
||||
schema.setNamespace(jp.nextTextValue());
|
||||
} else if ("Alias".equals(jp.getCurrentName())) {
|
||||
schema.setAlias(jp.nextTextValue());
|
||||
} else if ("ComplexType".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
schema.getComplexTypes().add(jp.readValueAs(ComplexTypeImpl.class));
|
||||
} else if ("EntityType".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
schema.getEntityTypes().add(jp.readValueAs(EntityTypeImpl.class));
|
||||
} else if ("EnumType".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
schema.getEnumTypes().add(jp.readValueAs(EnumTypeImpl.class));
|
||||
} else if ("EntityContainer".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
EntityContainerImpl entityContainer = jp.readValueAs(EntityContainerImpl.class);
|
||||
schema.setEntityContainer(entityContainer);
|
||||
} else if ("Action".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
schema.getActions().add(jp.readValueAs(ActionImpl.class));
|
||||
} else if ("Function".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
schema.getFunctions().add(jp.readValueAs(FunctionImpl.class));
|
||||
} else if ("TypeDefinition".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
schema.getTypeDefinitions().add(jp.readValueAs(TypeDefinitionImpl.class));
|
||||
}
|
||||
} else if ("Annotations".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
schema.getAnnotationGroups().add(jp.readValueAs(AnnotationsImpl.class));
|
||||
} else if ("Annotation".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
schema.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
|
||||
} else if ("Term".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
schema.getTerms().add(jp.readValueAs(TermImpl.class));
|
||||
}
|
||||
}
|
||||
|
||||
return schema;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,57 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.client.core.edm.xml;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
|
||||
public class SingletonDeserializer extends AbstractEdmDeserializer<SingletonImpl> {
|
||||
|
||||
@Override
|
||||
protected SingletonImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
|
||||
throws IOException, JsonProcessingException {
|
||||
|
||||
final SingletonImpl singleton = new SingletonImpl();
|
||||
|
||||
for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
|
||||
final JsonToken token = jp.getCurrentToken();
|
||||
if (token == JsonToken.FIELD_NAME) {
|
||||
if ("Name".equals(jp.getCurrentName())) {
|
||||
singleton.setName(jp.nextTextValue());
|
||||
} else if ("Type".equals(jp.getCurrentName())) {
|
||||
singleton.setType(jp.nextTextValue());
|
||||
} else if ("NavigationPropertyBinding".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
singleton.getNavigationPropertyBindings().add(
|
||||
jp.readValueAs(NavigationPropertyBindingImpl.class));
|
||||
} else if ("Annotation".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
singleton.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return singleton;
|
||||
}
|
||||
|
||||
}
|
@ -18,13 +18,45 @@
|
||||
*/
|
||||
package org.apache.olingo.client.core.edm.xml;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import org.apache.olingo.commons.api.edm.provider.Singleton;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
|
||||
@JsonDeserialize(using = SingletonDeserializer.class)
|
||||
import java.io.IOException;
|
||||
|
||||
@JsonDeserialize(using = SingletonImpl.SingletonDeserializer.class)
|
||||
public class SingletonImpl extends Singleton {
|
||||
|
||||
private static final long serialVersionUID = 1656749615107151921L;
|
||||
|
||||
static class SingletonDeserializer extends AbstractEdmDeserializer<SingletonImpl> {
|
||||
@Override
|
||||
protected SingletonImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
|
||||
throws IOException {
|
||||
final SingletonImpl singleton = new SingletonImpl();
|
||||
|
||||
for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
|
||||
final JsonToken token = jp.getCurrentToken();
|
||||
if (token == JsonToken.FIELD_NAME) {
|
||||
if ("Name".equals(jp.getCurrentName())) {
|
||||
singleton.setName(jp.nextTextValue());
|
||||
} else if ("Type".equals(jp.getCurrentName())) {
|
||||
singleton.setType(jp.nextTextValue());
|
||||
} else if ("NavigationPropertyBinding".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
singleton.getNavigationPropertyBindings().add(
|
||||
jp.readValueAs(NavigationPropertyBindingImpl.class));
|
||||
} else if ("Annotation".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
singleton.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return singleton;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,79 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.client.core.edm.xml;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.olingo.commons.api.edm.geo.SRID;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
|
||||
public class TermDeserializer extends AbstractEdmDeserializer<TermImpl> {
|
||||
|
||||
@Override
|
||||
protected TermImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
|
||||
throws IOException, JsonProcessingException {
|
||||
|
||||
final TermImpl term = new TermImpl();
|
||||
|
||||
for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
|
||||
final JsonToken token = jp.getCurrentToken();
|
||||
if (token == JsonToken.FIELD_NAME) {
|
||||
if ("Name".equals(jp.getCurrentName())) {
|
||||
term.setName(jp.nextTextValue());
|
||||
} else if ("Type".equals(jp.getCurrentName())) {
|
||||
term.setType(jp.nextTextValue());
|
||||
} else if ("BaseTerm".equals(jp.getCurrentName())) {
|
||||
term.setBaseTerm(jp.nextTextValue());
|
||||
} else if ("DefaultValue".equals(jp.getCurrentName())) {
|
||||
term.setDefaultValue(jp.nextTextValue());
|
||||
} else if ("Nullable".equals(jp.getCurrentName())) {
|
||||
term.setNullable(BooleanUtils.toBoolean(jp.nextTextValue()));
|
||||
} else if ("MaxLength".equals(jp.getCurrentName())) {
|
||||
final String maxLenght = jp.nextTextValue();
|
||||
term.setMaxLength(maxLenght.equalsIgnoreCase("max") ? Integer.MAX_VALUE : Integer.valueOf(maxLenght));
|
||||
} else if ("Precision".equals(jp.getCurrentName())) {
|
||||
term.setPrecision(Integer.valueOf(jp.nextTextValue()));
|
||||
} else if ("Scale".equals(jp.getCurrentName())) {
|
||||
final String scale = jp.nextTextValue();
|
||||
term.setScale(scale.equalsIgnoreCase("variable") ? 0 : Integer.valueOf(scale));
|
||||
} else if ("SRID".equals(jp.getCurrentName())) {
|
||||
final String srid = jp.nextTextValue();
|
||||
if (srid != null) {
|
||||
term.setSrid(SRID.valueOf(srid));
|
||||
}
|
||||
} else if ("AppliesTo".equals(jp.getCurrentName())) {
|
||||
term.getAppliesTo().addAll(Arrays.asList(StringUtils.split(jp.nextTextValue())));
|
||||
} else if ("Annotation".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
term.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return term;
|
||||
}
|
||||
|
||||
}
|
@ -18,13 +18,66 @@
|
||||
*/
|
||||
package org.apache.olingo.client.core.edm.xml;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.olingo.commons.api.edm.geo.SRID;
|
||||
import org.apache.olingo.commons.api.edm.provider.Term;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
|
||||
@JsonDeserialize(using = TermDeserializer.class)
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
|
||||
@JsonDeserialize(using = TermImpl.TermDeserializer.class)
|
||||
public class TermImpl extends Term {
|
||||
|
||||
private static final long serialVersionUID = -8350072064720586186L;
|
||||
|
||||
static class TermDeserializer extends AbstractEdmDeserializer<TermImpl> {
|
||||
@Override
|
||||
protected TermImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
|
||||
throws IOException {
|
||||
final TermImpl term = new TermImpl();
|
||||
|
||||
for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
|
||||
final JsonToken token = jp.getCurrentToken();
|
||||
if (token == JsonToken.FIELD_NAME) {
|
||||
if ("Name".equals(jp.getCurrentName())) {
|
||||
term.setName(jp.nextTextValue());
|
||||
} else if ("Type".equals(jp.getCurrentName())) {
|
||||
term.setType(jp.nextTextValue());
|
||||
} else if ("BaseTerm".equals(jp.getCurrentName())) {
|
||||
term.setBaseTerm(jp.nextTextValue());
|
||||
} else if ("DefaultValue".equals(jp.getCurrentName())) {
|
||||
term.setDefaultValue(jp.nextTextValue());
|
||||
} else if ("Nullable".equals(jp.getCurrentName())) {
|
||||
term.setNullable(BooleanUtils.toBoolean(jp.nextTextValue()));
|
||||
} else if ("MaxLength".equals(jp.getCurrentName())) {
|
||||
final String maxLenght = jp.nextTextValue();
|
||||
term.setMaxLength(maxLenght.equalsIgnoreCase("max") ? Integer.MAX_VALUE : Integer.valueOf(maxLenght));
|
||||
} else if ("Precision".equals(jp.getCurrentName())) {
|
||||
term.setPrecision(Integer.valueOf(jp.nextTextValue()));
|
||||
} else if ("Scale".equals(jp.getCurrentName())) {
|
||||
final String scale = jp.nextTextValue();
|
||||
term.setScale(scale.equalsIgnoreCase("variable") ? 0 : Integer.valueOf(scale));
|
||||
} else if ("SRID".equals(jp.getCurrentName())) {
|
||||
final String srid = jp.nextTextValue();
|
||||
if (srid != null) {
|
||||
term.setSrid(SRID.valueOf(srid));
|
||||
}
|
||||
} else if ("AppliesTo".equals(jp.getCurrentName())) {
|
||||
term.getAppliesTo().addAll(Arrays.asList(StringUtils.split(jp.nextTextValue())));
|
||||
} else if ("Annotation".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
term.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return term;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,70 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.client.core.edm.xml;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.olingo.commons.api.edm.geo.SRID;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
|
||||
public class TypeDefinitionDeserializer extends AbstractEdmDeserializer<TypeDefinitionImpl> {
|
||||
|
||||
@Override
|
||||
protected TypeDefinitionImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
|
||||
throws IOException, JsonProcessingException {
|
||||
|
||||
final TypeDefinitionImpl typeDefinition = new TypeDefinitionImpl();
|
||||
|
||||
for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
|
||||
final JsonToken token = jp.getCurrentToken();
|
||||
if (token == JsonToken.FIELD_NAME) {
|
||||
if ("Name".equals(jp.getCurrentName())) {
|
||||
typeDefinition.setName(jp.nextTextValue());
|
||||
} else if ("UnderlyingType".equals(jp.getCurrentName())) {
|
||||
typeDefinition.setUnderlyingType(jp.nextTextValue());
|
||||
} else if ("MaxLength".equals(jp.getCurrentName())) {
|
||||
typeDefinition.setMaxLength(jp.nextIntValue(0));
|
||||
} else if ("Unicode".equals(jp.getCurrentName())) {
|
||||
typeDefinition.setUnicode(BooleanUtils.toBoolean(jp.nextTextValue()));
|
||||
} else if ("Precision".equals(jp.getCurrentName())) {
|
||||
typeDefinition.setPrecision(jp.nextIntValue(0));
|
||||
} else if ("Scale".equals(jp.getCurrentName())) {
|
||||
final String scale = jp.nextTextValue();
|
||||
typeDefinition.setScale(scale.equalsIgnoreCase("variable") ? 0 : Integer.valueOf(scale));
|
||||
} else if ("SRID".equals(jp.getCurrentName())) {
|
||||
final String srid = jp.nextTextValue();
|
||||
if (srid != null) {
|
||||
typeDefinition.setSrid(SRID.valueOf(srid));
|
||||
}
|
||||
} else if ("Annotation".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
typeDefinition.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return typeDefinition;
|
||||
}
|
||||
|
||||
}
|
@ -18,13 +18,57 @@
|
||||
*/
|
||||
package org.apache.olingo.client.core.edm.xml;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.olingo.commons.api.edm.geo.SRID;
|
||||
import org.apache.olingo.commons.api.edm.provider.TypeDefinition;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
|
||||
@JsonDeserialize(using = TypeDefinitionDeserializer.class)
|
||||
import java.io.IOException;
|
||||
|
||||
@JsonDeserialize(using = TypeDefinitionImpl.TypeDefinitionDeserializer.class)
|
||||
public class TypeDefinitionImpl extends TypeDefinition {
|
||||
|
||||
private static final long serialVersionUID = -902407149079419602L;
|
||||
|
||||
static class TypeDefinitionDeserializer extends AbstractEdmDeserializer<TypeDefinitionImpl> {
|
||||
@Override
|
||||
protected TypeDefinitionImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
|
||||
throws IOException {
|
||||
final TypeDefinitionImpl typeDefinition = new TypeDefinitionImpl();
|
||||
|
||||
for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
|
||||
final JsonToken token = jp.getCurrentToken();
|
||||
if (token == JsonToken.FIELD_NAME) {
|
||||
if ("Name".equals(jp.getCurrentName())) {
|
||||
typeDefinition.setName(jp.nextTextValue());
|
||||
} else if ("UnderlyingType".equals(jp.getCurrentName())) {
|
||||
typeDefinition.setUnderlyingType(jp.nextTextValue());
|
||||
} else if ("MaxLength".equals(jp.getCurrentName())) {
|
||||
typeDefinition.setMaxLength(jp.nextIntValue(0));
|
||||
} else if ("Unicode".equals(jp.getCurrentName())) {
|
||||
typeDefinition.setUnicode(BooleanUtils.toBoolean(jp.nextTextValue()));
|
||||
} else if ("Precision".equals(jp.getCurrentName())) {
|
||||
typeDefinition.setPrecision(jp.nextIntValue(0));
|
||||
} else if ("Scale".equals(jp.getCurrentName())) {
|
||||
final String scale = jp.nextTextValue();
|
||||
typeDefinition.setScale(scale.equalsIgnoreCase("variable") ? 0 : Integer.valueOf(scale));
|
||||
} else if ("SRID".equals(jp.getCurrentName())) {
|
||||
final String srid = jp.nextTextValue();
|
||||
if (srid != null) {
|
||||
typeDefinition.setSrid(SRID.valueOf(srid));
|
||||
}
|
||||
} else if ("Annotation".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
typeDefinition.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return typeDefinition;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,11 +23,27 @@ import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.aalto.stax.InputFactoryImpl;
|
||||
import com.fasterxml.aalto.stax.OutputFactoryImpl;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import com.fasterxml.jackson.databind.InjectableValues;
|
||||
import com.fasterxml.jackson.databind.deser.DeserializationProblemHandler;
|
||||
import com.fasterxml.jackson.dataformat.xml.JacksonXmlModule;
|
||||
import com.fasterxml.jackson.dataformat.xml.XmlFactory;
|
||||
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
|
||||
import org.apache.olingo.client.api.ODataClient;
|
||||
import org.apache.olingo.client.api.edm.xml.XMLMetadata;
|
||||
import org.apache.olingo.client.core.AbstractTest;
|
||||
import org.apache.olingo.client.core.edm.xml.EdmxImpl;
|
||||
import org.apache.olingo.client.core.edm.xml.XMLMetadataImpl;
|
||||
import org.apache.olingo.client.core.edm.xml.annotation.ConstantAnnotationExpressionImpl;
|
||||
import org.apache.olingo.client.core.edm.xml.annotation.PathImpl;
|
||||
import org.apache.olingo.commons.api.Constants;
|
||||
@ -44,7 +60,9 @@ import org.apache.olingo.commons.api.edm.EdmEnumType;
|
||||
import org.apache.olingo.commons.api.edm.EdmFunction;
|
||||
import org.apache.olingo.commons.api.edm.EdmFunctionImport;
|
||||
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
|
||||
import org.apache.olingo.commons.api.edm.EdmProperty;
|
||||
import org.apache.olingo.commons.api.edm.EdmSchema;
|
||||
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.annotation.EdmUrlRef;
|
||||
@ -58,15 +76,18 @@ import org.apache.olingo.commons.api.edm.provider.Function;
|
||||
import org.apache.olingo.commons.api.edm.provider.FunctionImport;
|
||||
import org.apache.olingo.commons.api.edm.provider.Schema;
|
||||
import org.apache.olingo.commons.api.edm.provider.Singleton;
|
||||
import org.apache.olingo.commons.api.edm.provider.Term;
|
||||
import org.apache.olingo.commons.api.edm.provider.annotation.Apply;
|
||||
import org.apache.olingo.commons.api.edm.provider.annotation.Collection;
|
||||
import org.apache.olingo.commons.api.edm.provider.annotation.ConstantAnnotationExpression;
|
||||
import org.apache.olingo.commons.api.edm.provider.annotation.TwoParamsOpDynamicAnnotationExpression;
|
||||
import org.apache.olingo.commons.api.edm.provider.annotation.UrlRef;
|
||||
import org.apache.olingo.commons.api.format.ODataFormat;
|
||||
import org.apache.olingo.commons.core.edm.primitivetype.EdmBoolean;
|
||||
import org.apache.olingo.commons.core.edm.primitivetype.EdmDecimal;
|
||||
import org.apache.olingo.commons.core.edm.primitivetype.EdmInt32;
|
||||
import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
public class MetadataTest extends AbstractTest {
|
||||
@ -396,4 +417,19 @@ public class MetadataTest extends AbstractTest {
|
||||
assertTrue(edmUrlRef.getValue().isDynamic());
|
||||
assertTrue(edmUrlRef.getValue().asDynamic().isApply());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void metadataWithCapabilities() throws Exception {
|
||||
InputStream input = getClass().getResourceAsStream("Metadata-With-Capabilities.xml");
|
||||
final XMLMetadata metadata = getClient().getDeserializer(ODataFormat.XML).
|
||||
toMetadata(input);
|
||||
|
||||
Schema schema = metadata.getSchema("Capabilities");
|
||||
assertNotNull(schema);
|
||||
assertEquals(23, schema.getTerms().size());
|
||||
|
||||
final Term deleteRestrictions = schema.getTerm("DeleteRestrictions");
|
||||
assertNotNull(deleteRestrictions);
|
||||
assertEquals("Capabilities.DeleteRestrictionsType", deleteRestrictions.getType());
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,323 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
|
||||
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.
|
||||
|
||||
-->
|
||||
<edmx:Edmx xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Version="4.0">
|
||||
<edmx:DataServices>
|
||||
<Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="Org.OData.Capabilities.V1" Alias="Capabilities">
|
||||
<Annotation Term="Core.Description">
|
||||
<String>
|
||||
The Capabilities vocabulary aims to provide a way for service authors to describe
|
||||
certain capabilities of an OData Service.
|
||||
</String>
|
||||
</Annotation>
|
||||
<Annotation Term="Core.LongDescription">
|
||||
<String>
|
||||
There are some capabilities which are strongly recommended for services to support even
|
||||
though they are optional. Support for $top and $skip is a good example as
|
||||
supporting these query options helps with performance of a service and are essential. Such
|
||||
capabilities are assumed to be default capabilities of an OData service even in
|
||||
the case that a capabilities annotation doesn’t exist. Capabilities annotations are
|
||||
mainly expected to be used to explicitly specify that a service doesn’t support such
|
||||
capabilities. Capabilities annotations can as well be used to declaratively
|
||||
specify the support of such capabilities.
|
||||
|
||||
On the other hand, there are some capabilities that a service may choose to support or
|
||||
not support and in varying degrees. $filter and $orderby are such good examples.
|
||||
This vocabulary aims to define terms to specify support or no support for such
|
||||
capabilities.
|
||||
|
||||
A service is assumed to support by default the following capabilities even though an
|
||||
annotation doesn’t exist:
|
||||
- Countability ($count, $inlinecount)
|
||||
- Client pageability ($top, $skip)
|
||||
- Expandability ($expand)
|
||||
- Indexability by key
|
||||
- Batch support ($batch)
|
||||
- Navigability of navigation properties
|
||||
|
||||
A service is expected to support the following capabilities. If not supported, the
|
||||
service is expected to call out the restrictions using annotations:
|
||||
- Filterability ($filter)
|
||||
- Sortability ($orderby)
|
||||
- Queryability of top level entity sets
|
||||
- Query functions
|
||||
|
||||
A client cannot assume that a service supports certain capabilities. A client can try, but
|
||||
it needs to be prepared to handle an error in case the following capabilities are not
|
||||
supported:
|
||||
- Insertability
|
||||
- Updatability
|
||||
- Deletability
|
||||
</String>
|
||||
</Annotation>
|
||||
|
||||
<!-- Conformance Level -->
|
||||
|
||||
<Term Name="ConformanceLevel" Type="Capabilities.ConformanceLevelType" AppliesTo="EntityContainer" />
|
||||
<EnumType Name="ConformanceLevelType">
|
||||
<Member Name="Minimal" />
|
||||
<Member Name="Intermediate" />
|
||||
<Member Name="Advanced" />
|
||||
</EnumType>
|
||||
|
||||
<!-- Request Capabilities -->
|
||||
|
||||
<Term Name="SupportedFormats" Type="Collection(Edm.String)">
|
||||
<Annotation Term="Core.Description" String="Media types of supported formats, including format parameters" />
|
||||
<Annotation Term="Core.IsMediaType" />
|
||||
</Term>
|
||||
|
||||
<Term Name="AcceptableEncodings" Type="Collection(Edm.String)" AppliesTo="EntityContainer">
|
||||
<Annotation Term="Core.Description" String="List of acceptable compression methods for ($batch) requests, e.g. gzip" />
|
||||
</Term>
|
||||
|
||||
<!-- Supported Preferences -->
|
||||
|
||||
<Term Name="AsynchronousRequestsSupported" Type="Core.Tag" DefaultValue="true" AppliesTo="EntityContainer">
|
||||
<Annotation Term="Core.Description" String="Service supports the asynchronous request preference" />
|
||||
</Term>
|
||||
|
||||
<Term Name="BatchContinueOnErrorSupported" Type="Core.Tag" DefaultValue="true" AppliesTo="EntityContainer">
|
||||
<Annotation Term="Core.Description" String="Service supports the continue on error preference" />
|
||||
</Term>
|
||||
|
||||
<Term Name="IsolationSupported" Type="Capabilities.IsolationLevel" AppliesTo="EntityContainer">
|
||||
<Annotation Term="Core.Description" String="Supported odata.isolation levels" />
|
||||
</Term>
|
||||
<EnumType Name="IsolationLevel" IsFlags="true">
|
||||
<Member Name="Snapshot" Value="1" />
|
||||
</EnumType>
|
||||
|
||||
<Term Name="CallbackSupported" Type="Capabilities.CallbackType" AppliesTo="EntityContainer EntitySet">
|
||||
<Annotation Term="Core.Description" String="Supports callbacks for the specified protocols" />
|
||||
</Term>
|
||||
<Term Name="CrossJoinSupported" Type="Core.Tag" DefaultValue="true" AppliesTo="EntityContainer">
|
||||
<Annotation Term="Core.Description" String="Supports cross joins for the entity sets in this container" />
|
||||
</Term>
|
||||
<ComplexType Name="CallbackType">
|
||||
<Property Name="CallbackProtocols" Type="Collection(Capabilities.CallbackProtocol)" />
|
||||
<Annotation Term="Core.Description"
|
||||
String="A non-empty collection lists the full set of supported protocols. A empty collection means 'only HTTP is supported'" />
|
||||
</ComplexType>
|
||||
<ComplexType Name="CallbackProtocol">
|
||||
<Property Name="Id" Type="Edm.String">
|
||||
<Annotation Term="Core.Description" String="Protcol Identifier" />
|
||||
</Property>
|
||||
<Property Name="UrlTemplate" Type="Edm.String">
|
||||
<Annotation Term="Core.Description"
|
||||
String="URL Template including parameters. Parameters are enclosed in curly braces {} as defined in RFC6570" />
|
||||
</Property>
|
||||
<Property Name="DocumentationUrl" Type="Edm.String" Nullable="true">
|
||||
<Annotation Term="Core.Description" String="Human readable description of the meaning of the URL Template parameters" />
|
||||
<Annotation Term="Core.IsURL" />
|
||||
</Property>
|
||||
</ComplexType>
|
||||
|
||||
<Term Name="ChangeTracking" Type="Capabilities.ChangeTrackingType" AppliesTo="EntityContainer EntitySet">
|
||||
<Annotation Term="Core.Description" String="Change tracking capabilities of this service or entity set" />
|
||||
</Term>
|
||||
<ComplexType Name="ChangeTrackingType">
|
||||
<Property Name="Supported" Type="Edm.Boolean" DefaultValue="true">
|
||||
<Annotation Term="Core.Description" String="This entity set supports the odata.track-changes preference" />
|
||||
</Property>
|
||||
<Property Name="FilterableProperties" Type="Collection(Edm.PropertyPath)">
|
||||
<Annotation Term="Core.Description" String="Change tracking supports filters on these properties" />
|
||||
</Property>
|
||||
<Property Name="ExpandableProperties" Type="Collection(Edm.NavigationPropertyPath)">
|
||||
<Annotation Term="Core.Description" String="Change tracking supports these properties expanded" />
|
||||
</Property>
|
||||
</ComplexType>
|
||||
|
||||
<!--Query Capabilities -->
|
||||
|
||||
<Term Name="CountRestrictions" Type="Capabilities.CountRestrictionsType" AppliesTo="EntitySet">
|
||||
<Annotation Term="Core.Description" String="Restrictions on /$count path suffix and $count=true system query option" />
|
||||
</Term>
|
||||
<ComplexType Name="CountRestrictionsType">
|
||||
<Property Name="Countable" Type="Edm.Boolean" DefaultValue="true">
|
||||
<Annotation Term="Core.Description" String="Entities can be counted" />
|
||||
</Property>
|
||||
<Property Name="NonCountableProperties" Type="Collection(Edm.PropertyPath)">
|
||||
<Annotation Term="Core.Description" String="These collection properties do not allow /$count segments" />
|
||||
</Property>
|
||||
<Property Name="NonCountableNavigationProperties" Type="Collection(Edm.NavigationPropertyPath)">
|
||||
<Annotation Term="Core.Description" String="These navigation properties do not allow /$count segments" />
|
||||
</Property>
|
||||
</ComplexType>
|
||||
|
||||
<Term Name="NavigationRestrictions" Type="Capabilities.NavigationRestrictionsType" AppliesTo="EntitySet">
|
||||
<Annotation Term="Core.Description" String="Restrictions on navigating properties according to OData URL conventions" />
|
||||
</Term>
|
||||
<ComplexType Name="NavigationRestrictionsType">
|
||||
<Property Name="Navigability" Type="Capabilities.NavigationType">
|
||||
<Annotation Term="Core.Description" String="Supported Navigability" />
|
||||
</Property>
|
||||
<Property Name="RestrictedProperties" Type="Collection(Capabilities.NavigationPropertyRestriction)" />
|
||||
</ComplexType>
|
||||
<ComplexType Name="NavigationPropertyRestriction">
|
||||
<Property Name="NavigationProperty" Type="Edm.NavigationPropertyPath">
|
||||
<Annotation Term="Core.Description" String="Navigation properties can be navigated to a single level" />
|
||||
</Property>
|
||||
<Property Name="Navigability" Type="Capabilities.NavigationType">
|
||||
<Annotation Term="Core.Description" String="Navigation properties can be navigated to a single level" />
|
||||
</Property>
|
||||
</ComplexType>
|
||||
<EnumType Name="NavigationType">
|
||||
<Member Name="Recursive">
|
||||
<Annotation Term="Core.Description" String="Navigation properties can be recursively navigated" />
|
||||
</Member>
|
||||
<Member Name="Single">
|
||||
<Annotation Term="Core.Description" String="Navigation properties can be navigated to a single level" />
|
||||
</Member>
|
||||
<Member Name="None">
|
||||
<Annotation Term="Core.Description" String="Navigation properties are not navigable" />
|
||||
</Member>
|
||||
</EnumType>
|
||||
|
||||
<Term Name="IndexableByKey" Type="Core.Tag" DefaultValue="true" AppliesTo="EntitySet">
|
||||
<Annotation Term="Core.Description" String="Supports key values according to OData URL conventions" />
|
||||
</Term>
|
||||
|
||||
<Term Name="TopSupported" Type="Core.Tag" DefaultValue="true" AppliesTo="EntitySet">
|
||||
<Annotation Term="Core.Description" String="Supports $top" />
|
||||
</Term>
|
||||
<Term Name="SkipSupported" Type="Core.Tag" DefaultValue="true" AppliesTo="EntitySet">
|
||||
<Annotation Term="Core.Description" String="Supports $skip" />
|
||||
</Term>
|
||||
|
||||
<Term Name="BatchSupported" Type="Core.Tag" DefaultValue="true" AppliesTo="EntityContainer">
|
||||
<Annotation Term="Core.Description" String="Supports $batch requests" />
|
||||
</Term>
|
||||
|
||||
<Term Name="FilterFunctions" Type="Collection(Edm.String)" AppliesTo="EntityContainer EntitySet">
|
||||
<Annotation Term="Core.Description" String="List of functions supported in $filter" />
|
||||
</Term>
|
||||
|
||||
<Term Name="FilterRestrictions" Type="Capabilities.FilterRestrictionsType" AppliesTo="EntitySet">
|
||||
<Annotation Term="Core.Description" String="Restrictions on $filter expressions" />
|
||||
</Term>
|
||||
<ComplexType Name="FilterRestrictionsType">
|
||||
<Property Name="Filterable" Type="Edm.Boolean" DefaultValue="true">
|
||||
<Annotation Term="Core.Description" String="$filter is supported" />
|
||||
</Property>
|
||||
<Property Name="RequiresFilter" Type="Edm.Boolean" Nullable="true">
|
||||
<Annotation Term="Core.Description" String="$filter is required" />
|
||||
</Property>
|
||||
<Property Name="RequiredProperties" Type="Collection(Edm.PropertyPath)">
|
||||
<Annotation Term="Core.Description"
|
||||
String="These properties must be specified in the $filter clause (properties of derived types are not allowed here)" />
|
||||
</Property>
|
||||
<Property Name="NonFilterableProperties" Type="Collection(Edm.PropertyPath)">
|
||||
<Annotation Term="Core.Description" String="These properties cannot be used in $filter expressions" />
|
||||
</Property>
|
||||
</ComplexType>
|
||||
|
||||
<Term Name="SortRestrictions" Type="Capabilities.SortRestrictionsType" AppliesTo="EntitySet">
|
||||
<Annotation Term="Core.Description" String="Restrictions on $orderby expressions" />
|
||||
</Term>
|
||||
<ComplexType Name="SortRestrictionsType">
|
||||
<Property Name="Sortable" Type="Edm.Boolean" DefaultValue="true">
|
||||
<Annotation Term="Core.Description" String="$orderby is supported" />
|
||||
</Property>
|
||||
<Property Name="AscendingOnlyProperties" Type="Collection(Edm.PropertyPath)">
|
||||
<Annotation Term="Core.Description" String="These properties can only be used for sorting in Ascending order" />
|
||||
</Property>
|
||||
<Property Name="DescendingOnlyProperties" Type="Collection(Edm.PropertyPath)">
|
||||
<Annotation Term="Core.Description" String="These properties can only be used for sorting in Descending order" />
|
||||
</Property>
|
||||
<Property Name="NonSortableProperties" Type="Collection(Edm.PropertyPath)">
|
||||
<Annotation Term="Core.Description" String="These properties cannot be used in $orderby expressions" />
|
||||
</Property>
|
||||
</ComplexType>
|
||||
|
||||
<Term Name="ExpandRestrictions" Type="Capabilities.ExpandRestrictionsType" AppliesTo="EntitySet">
|
||||
<Annotation Term="Core.Description" String="Restrictions on $expand expressions" />
|
||||
</Term>
|
||||
<ComplexType Name="ExpandRestrictionsType">
|
||||
<Property Name="Expandable" Type="Edm.Boolean" DefaultValue="true">
|
||||
<Annotation Term="Core.Description" String="$expand is supported" />
|
||||
</Property>
|
||||
<Property Name="NonExpandableProperties" Type="Collection(Edm.NavigationPropertyPath)">
|
||||
<Annotation Term="Core.Description" String="These properties cannot be used in $expand expressions" />
|
||||
</Property>
|
||||
</ComplexType>
|
||||
|
||||
<Term Name="SearchRestrictions" Type="Capabilities.SearchRestrictionsType" AppliesTo="EntitySet">
|
||||
<Annotation Term="Core.Description" String="Restrictions on $search expressions" />
|
||||
</Term>
|
||||
<ComplexType Name="SearchRestrictionsType">
|
||||
<Property Name="Searchable" Type="Edm.Boolean" DefaultValue="true">
|
||||
<Annotation Term="Core.Description" String="$search is supported" />
|
||||
</Property>
|
||||
<Property Name="UnsupportedExpressions" Type="Capabilities.SearchExpressions" DefaultValue="none">
|
||||
<Annotation Term="Core.Description" String="Expressions supported in $search" />
|
||||
</Property>
|
||||
</ComplexType>
|
||||
<EnumType Name="SearchExpressions" IsFlags="true">
|
||||
<Member Name="none" Value="0" />
|
||||
<Member Name="AND" Value="1" />
|
||||
<Member Name="OR" Value="2" />
|
||||
<Member Name="NOT" Value="4" />
|
||||
<Member Name="phrase" Value="8" />
|
||||
<Member Name="group" Value="16" />
|
||||
</EnumType>
|
||||
|
||||
<!-- Data Modification Capabilities -->
|
||||
|
||||
<Term Name="InsertRestrictions" Type="Capabilities.InsertRestrictionsType" AppliesTo="EntitySet">
|
||||
<Annotation Term="Core.Description" String="Restrictions on insert operations" />
|
||||
</Term>
|
||||
<ComplexType Name="InsertRestrictionsType">
|
||||
<Property Name="Insertable" Type="Edm.Boolean" DefaultValue="true">
|
||||
<Annotation Term="Core.Description" String="Entities can be inserted" />
|
||||
</Property>
|
||||
<Property Name="NonInsertableNavigationProperties" Type="Collection(Edm.NavigationPropertyPath)">
|
||||
<Annotation Term="Core.Description" String="These navigation properties do not allow deep inserts" />
|
||||
</Property>
|
||||
</ComplexType>
|
||||
|
||||
<Term Name="UpdateRestrictions" Type="Capabilities.UpdateRestrictionsType" AppliesTo="EntitySet">
|
||||
<Annotation Term="Core.Description" String="Restrictions on update operations" />
|
||||
</Term>
|
||||
<ComplexType Name="UpdateRestrictionsType">
|
||||
<Property Name="Updatable" Type="Edm.Boolean" DefaultValue="true">
|
||||
<Annotation Term="Core.Description" String="Entities can be updated" />
|
||||
</Property>
|
||||
<Property Name="NonUpdatableNavigationProperties" Type="Collection(Edm.NavigationPropertyPath)">
|
||||
<Annotation Term="Core.Description" String="These navigation properties do not allow rebinding" />
|
||||
</Property>
|
||||
</ComplexType>
|
||||
|
||||
<Term Name="DeleteRestrictions" Type="Capabilities.DeleteRestrictionsType" AppliesTo="EntitySet">
|
||||
<Annotation Term="Core.Description" String="Restrictions on delete operations" />
|
||||
</Term>
|
||||
<ComplexType Name="DeleteRestrictionsType">
|
||||
<Property Name="Deletable" Type="Edm.Boolean" DefaultValue="true">
|
||||
<Annotation Term="Core.Description" String="Entities can be deleted" />
|
||||
</Property>
|
||||
<Property Name="NonDeletableNavigationProperties" Type="Collection(Edm.NavigationPropertyPath)">
|
||||
<Annotation Term="Core.Description" String="These navigation properties do not allow DeleteLink requests" />
|
||||
</Property>
|
||||
</ComplexType>
|
||||
|
||||
</Schema>
|
||||
</edmx:DataServices>
|
||||
</edmx:Edmx>
|
Loading…
x
Reference in New Issue
Block a user