http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/111239d7/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataComplexValueImpl.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataComplexValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataComplexValueImpl.java new file mode 100644 index 0000000..bd148b2 --- /dev/null +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataComplexValueImpl.java @@ -0,0 +1,161 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.olingo.commons.core.domain; + +import org.apache.olingo.commons.api.domain.ODataAnnotation; +import org.apache.olingo.commons.api.domain.ODataComplexValue; +import org.apache.olingo.commons.api.domain.ODataEnumValue; +import org.apache.olingo.commons.api.domain.ODataLink; +import org.apache.olingo.commons.api.domain.ODataLinkedComplexValue; +import org.apache.olingo.commons.api.domain.ODataProperty; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +public class ODataComplexValueImpl extends AbstractODataComplexValue<ODataProperty> implements ODataLinkedComplexValue { + + /** + * Navigation links (might contain in-line entities or entity sets). + */ + private final List<ODataLink> navigationLinks = new ArrayList<ODataLink>(); + + /** + * Association links. + */ + private final List<ODataLink> associationLinks = new ArrayList<ODataLink>(); + + private final List<ODataAnnotation> annotations = new ArrayList<ODataAnnotation>(); + + public ODataComplexValueImpl(final String typeName) { + super(typeName); + } + + @Override + protected ODataComplexValue<ODataProperty> getThis() { + return this; + } + + @Override + public boolean isEnum() { + return false; + } + + @Override + public ODataEnumValue asEnum() { + return null; + } + + @Override + public boolean isLinkedComplex() { + return true; + } + + @Override + public ODataLinkedComplexValue asLinkedComplex() { + return this; + } + + @Override + public boolean addLink(final ODataLink link) { + boolean result = false; + + switch (link.getType()) { + case ASSOCIATION: + result = associationLinks.contains(link) ? false : associationLinks.add(link); + break; + + case ENTITY_NAVIGATION: + case ENTITY_SET_NAVIGATION: + result = navigationLinks.contains(link) ? false : navigationLinks.add(link); + break; + + case MEDIA_EDIT: + throw new IllegalArgumentException("Complex values cannot have media links!"); + + default: + } + + return result; + } + + @Override + public boolean removeLink(final ODataLink link) { + return associationLinks.remove(link) || navigationLinks.remove(link); + } + + private ODataLink getLink(final List<ODataLink> links, final String name) { + ODataLink result = null; + for (ODataLink link : links) { + if (name.equals(link.getName())) { + result = link; + } + } + + return result; + } + + @Override + public ODataLink getNavigationLink(final String name) { + return getLink(navigationLinks, name); + } + + @Override + public List<ODataLink> getNavigationLinks() { + return navigationLinks; + } + + @Override + public ODataLink getAssociationLink(final String name) { + return getLink(associationLinks, name); + } + + @Override + public List<ODataLink> getAssociationLinks() { + return associationLinks; + } + + @Override + public Map<String, Object> asJavaMap() { + final Map<String, Object> result = new LinkedHashMap<String, Object>(); + for (Map.Entry<String, ODataProperty> entry : fields.entrySet()) { + Object value = null; + if (entry.getValue().hasPrimitiveValue()) { + value = entry.getValue().getPrimitiveValue().toValue(); + } else if (entry.getValue().hasComplexValue()) { + value = entry.getValue().getComplexValue().asJavaMap(); + } else if (entry.getValue().hasCollectionValue()) { + value = entry.getValue().getCollectionValue().asJavaCollection(); + } else if (entry.getValue().hasEnumValue()) { + value = entry.getValue().getEnumValue().toString(); + } + + result.put(entry.getKey(), value); + } + + return result; + } + + @Override + public List<ODataAnnotation> getAnnotations() { + return annotations; + } + +}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/111239d7/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataDeletedEntityImpl.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataDeletedEntityImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataDeletedEntityImpl.java new file mode 100644 index 0000000..4021996 --- /dev/null +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataDeletedEntityImpl.java @@ -0,0 +1,54 @@ +/* + * 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.commons.core.domain; + +import org.apache.olingo.commons.api.domain.ODataDeletedEntity; +import org.apache.olingo.commons.api.domain.ODataItem; + +import java.net.URI; + +public class ODataDeletedEntityImpl extends ODataItem implements ODataDeletedEntity { + + private URI id; + + private Reason reason; + + public ODataDeletedEntityImpl() { + super(null); + } + + @Override + public URI getId() { + return id; + } + + public void setId(final URI id) { + this.id = id; + } + + @Override + public Reason getReason() { + return reason; + } + + public void setReason(final Reason reason) { + this.reason = reason; + } + +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/111239d7/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataDeltaImpl.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataDeltaImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataDeltaImpl.java new file mode 100644 index 0000000..f8d6fdf --- /dev/null +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataDeltaImpl.java @@ -0,0 +1,60 @@ +/* + * 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.commons.core.domain; + +import org.apache.olingo.commons.api.domain.ODataDeletedEntity; +import org.apache.olingo.commons.api.domain.ODataDelta; +import org.apache.olingo.commons.api.domain.ODataDeltaLink; + +import java.net.URI; +import java.util.ArrayList; +import java.util.List; + +public class ODataDeltaImpl extends ODataEntitySetImpl implements ODataDelta { + + private final List<ODataDeletedEntity> deletedEntities = new ArrayList<ODataDeletedEntity>(); + + private final List<ODataDeltaLink> addedLinks = new ArrayList<ODataDeltaLink>(); + + private final List<ODataDeltaLink> deletedLinks = new ArrayList<ODataDeltaLink>(); + + public ODataDeltaImpl() { + super(); + } + + public ODataDeltaImpl(final URI next) { + super(next); + } + + @Override + public List<ODataDeletedEntity> getDeletedEntities() { + return deletedEntities; + } + + @Override + public List<ODataDeltaLink> getAddedLinks() { + return addedLinks; + } + + @Override + public List<ODataDeltaLink> getDeletedLinks() { + return deletedLinks; + } + +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/111239d7/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataDeltaLinkImpl.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataDeltaLinkImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataDeltaLinkImpl.java new file mode 100644 index 0000000..5a39382 --- /dev/null +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataDeltaLinkImpl.java @@ -0,0 +1,78 @@ +/* + * 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.commons.core.domain; + +import org.apache.olingo.commons.api.domain.ODataAnnotation; +import org.apache.olingo.commons.api.domain.ODataDeltaLink; +import org.apache.olingo.commons.api.domain.ODataItem; + +import java.net.URI; +import java.util.ArrayList; +import java.util.List; + +public class ODataDeltaLinkImpl extends ODataItem implements ODataDeltaLink { + + private URI source; + + private String relationship; + + private URI target; + + private final List<ODataAnnotation> annotations = new ArrayList<ODataAnnotation>(); + + public ODataDeltaLinkImpl() { + super(null); + } + + @Override + public URI getSource() { + return source; + } + + @Override + public void setSource(final URI source) { + this.source = source; + } + + @Override + public String getRelationship() { + return relationship; + } + + @Override + public void setRelationship(final String relationship) { + this.relationship = relationship; + } + + @Override + public URI getTarget() { + return target; + } + + @Override + public void setTarget(final URI target) { + this.target = target; + } + + @Override + public List<ODataAnnotation> getAnnotations() { + return annotations; + } + +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/111239d7/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEntityImpl.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEntityImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEntityImpl.java new file mode 100644 index 0000000..84bba6d --- /dev/null +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEntityImpl.java @@ -0,0 +1,70 @@ +/* + * 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.commons.core.domain; + +import java.net.URI; +import java.util.ArrayList; +import java.util.List; + +import org.apache.olingo.commons.api.domain.ODataAnnotation; +import org.apache.olingo.commons.api.domain.ODataProperty; +import org.apache.olingo.commons.api.domain.ODataSingleton; +import org.apache.olingo.commons.api.edm.FullQualifiedName; + +public class ODataEntityImpl extends AbstractODataEntity implements ODataSingleton { + + /** + * Entity id. + */ + private URI id; + + private final List<ODataProperty> properties = new ArrayList<ODataProperty>(); + + private final List<ODataAnnotation> annotations = new ArrayList<ODataAnnotation>(); + + public ODataEntityImpl(final FullQualifiedName typeName) { + super(typeName); + } + + @Override + public URI getId() { + return id; + } + + @Override + public void setId(final URI id) { + this.id = id; + } + + @Override + public ODataProperty getProperty(final String name) { + return (ODataProperty) super.getProperty(name); + } + + @Override + public List<ODataProperty> getProperties() { + return properties; + } + + @Override + public List<ODataAnnotation> getAnnotations() { + return annotations; + } + +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/111239d7/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEntitySetImpl.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEntitySetImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEntitySetImpl.java new file mode 100644 index 0000000..b6853c1 --- /dev/null +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEntitySetImpl.java @@ -0,0 +1,65 @@ +/* + * 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.commons.core.domain; + +import org.apache.olingo.commons.api.domain.ODataAnnotation; +import org.apache.olingo.commons.api.domain.ODataEntity; +import org.apache.olingo.commons.api.domain.ODataEntitySet; + +import java.net.URI; +import java.util.ArrayList; +import java.util.List; + +public class ODataEntitySetImpl extends AbstractODataEntitySet implements ODataEntitySet { + + private URI deltaLink; + + private final List<ODataEntity> entities = new ArrayList<ODataEntity>(); + + private final List<ODataAnnotation> annotations = new ArrayList<ODataAnnotation>(); + + public ODataEntitySetImpl() { + super(); + } + + public ODataEntitySetImpl(final URI next) { + super(next); + } + + @Override + public List<ODataEntity> getEntities() { + return entities; + } + + @Override + public URI getDeltaLink() { + return deltaLink; + } + + @Override + public void setDeltaLink(final URI deltaLink) { + this.deltaLink = deltaLink; + } + + @Override + public List<ODataAnnotation> getAnnotations() { + return annotations; + } + +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/111239d7/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEnumValueImpl.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEnumValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEnumValueImpl.java new file mode 100644 index 0000000..bf76376 --- /dev/null +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEnumValueImpl.java @@ -0,0 +1,65 @@ +/* + * 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.commons.core.domain; + +import org.apache.olingo.commons.api.domain.AbstractODataValue; +import org.apache.olingo.commons.api.domain.ODataEnumValue; +import org.apache.olingo.commons.api.domain.ODataLinkedComplexValue; + +public class ODataEnumValueImpl extends AbstractODataValue implements ODataEnumValue { + + private final String value; + + public ODataEnumValueImpl(final String typeName, final String value) { + super(typeName); + this.value = value; + } + + @Override + public String getValue() { + return value; + } + + @Override + public boolean isEnum() { + return true; + } + + @Override + public ODataEnumValue asEnum() { + return this; + } + + @Override + public boolean isLinkedComplex() { + return false; + } + + @Override + public ODataLinkedComplexValue asLinkedComplex() { + return null; + } + + @Override + public String toString() { + return getTypeName() + "'" + getValue() + "'"; + + } + +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/111239d7/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataObjectFactoryImpl.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataObjectFactoryImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataObjectFactoryImpl.java new file mode 100644 index 0000000..7f7a81c --- /dev/null +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataObjectFactoryImpl.java @@ -0,0 +1,156 @@ +/* + * 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.commons.core.domain; + +import org.apache.olingo.commons.api.domain.CommonODataProperty; +import org.apache.olingo.commons.api.domain.ODataCollectionValue; +import org.apache.olingo.commons.api.domain.ODataComplexValue; +import org.apache.olingo.commons.api.domain.ODataDelta; +import org.apache.olingo.commons.api.domain.ODataEntity; +import org.apache.olingo.commons.api.domain.ODataEntitySet; +import org.apache.olingo.commons.api.domain.ODataEnumValue; +import org.apache.olingo.commons.api.domain.ODataLink; +import org.apache.olingo.commons.api.domain.ODataLinkType; +import org.apache.olingo.commons.api.domain.ODataLinkedComplexValue; +import org.apache.olingo.commons.api.domain.ODataObjectFactory; +import org.apache.olingo.commons.api.domain.ODataPrimitiveValue; +import org.apache.olingo.commons.api.domain.ODataProperty; +import org.apache.olingo.commons.api.domain.ODataSingleton; +import org.apache.olingo.commons.api.domain.ODataValue; +import org.apache.olingo.commons.api.edm.FullQualifiedName; +import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; + +import java.net.URI; + +public class ODataObjectFactoryImpl extends AbstractODataObjectFactory implements ODataObjectFactory { + + public ODataObjectFactoryImpl(final ODataServiceVersion version) { + super(version); + } + + @Override + public ODataEntitySet newEntitySet() { + return new ODataEntitySetImpl(); + } + + @Override + public ODataEntitySet newEntitySet(final URI next) { + return new ODataEntitySetImpl(next); + } + + @Override + public ODataEntity newEntity(final FullQualifiedName typeName) { + return new ODataEntityImpl(typeName); + } + + @Override + public ODataEntity newEntity(final FullQualifiedName typeName, final URI link) { + final ODataEntityImpl result = new ODataEntityImpl(typeName); + result.setLink(link); + return result; + } + + @Override + public ODataSingleton newSingleton(final FullQualifiedName typeName) { + return new ODataEntityImpl(typeName); + } + + @Override + public ODataLink newEntityNavigationLink(final String name, final URI link) { + return new ODataLink.Builder().setVersion(version).setURI(link). + setType(ODataLinkType.ENTITY_NAVIGATION).setTitle(name).build(); + } + + @Override + public ODataLink newEntitySetNavigationLink(final String name, final URI link) { + return new ODataLink.Builder().setVersion(version).setURI(link). + setType(ODataLinkType.ENTITY_SET_NAVIGATION).setTitle(name).build(); + } + + @Override + public ODataLink newAssociationLink(final String name, final URI link) { + return new ODataLink.Builder().setVersion(version).setURI(link). + setType(ODataLinkType.ASSOCIATION).setTitle(name).build(); + } + + @Override + public ODataLink newMediaEditLink(final String name, final URI link) { + return new ODataLink.Builder().setVersion(version).setURI(link). + setType(ODataLinkType.MEDIA_EDIT).setTitle(name).build(); + } + + @Override + public ODataPrimitiveValue.Builder newPrimitiveValueBuilder() { + return new ODataPrimitiveValueImpl.BuilderImpl(version); + } + + @Override + public ODataEnumValue newEnumValue(final String typeName, final String value) { + return new ODataEnumValueImpl(typeName, value); + } + + @Override + public ODataComplexValue<ODataProperty> newComplexValue(final String typeName) { + return new ODataComplexValueImpl(typeName); + } + + @Override + public ODataLinkedComplexValue newLinkedComplexValue(final String typeName) { + return new ODataComplexValueImpl(typeName); + } + + @Override + public ODataCollectionValue<ODataValue> newCollectionValue(final String typeName) { + return new ODataCollectionValueImpl(typeName); + } + + @Override + public ODataProperty newPrimitiveProperty(final String name, final ODataPrimitiveValue value) { + return new ODataPropertyImpl(name, value); + } + + @Override + public ODataProperty newComplexProperty(final String name, + final ODataComplexValue<? extends CommonODataProperty> value) { + + return new ODataPropertyImpl(name, value); + } + + @Override + public ODataProperty newCollectionProperty(final String name, + final ODataCollectionValue<? extends org.apache.olingo.commons.api.domain.ODataValue> value) { + + return new ODataPropertyImpl(name, value); + } + + @Override + public ODataProperty newEnumProperty(final String name, final ODataEnumValue value) { + return new ODataPropertyImpl(name, value); + } + + @Override + public ODataDelta newDelta() { + return new ODataDeltaImpl(); + } + + @Override + public ODataDelta newDelta(final URI next) { + return new ODataDeltaImpl(next); + } +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/111239d7/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPrimitiveValueImpl.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPrimitiveValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPrimitiveValueImpl.java new file mode 100644 index 0000000..e50d8ad --- /dev/null +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPrimitiveValueImpl.java @@ -0,0 +1,69 @@ +/* + * 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.commons.core.domain; + +import org.apache.olingo.commons.api.domain.ODataEnumValue; +import org.apache.olingo.commons.api.domain.ODataLinkedComplexValue; +import org.apache.olingo.commons.api.domain.ODataValue; +import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; + +public class ODataPrimitiveValueImpl extends AbstractODataPrimitiveValue implements ODataValue { + + public static class BuilderImpl extends AbstractBuilder { + + private final ODataPrimitiveValueImpl instance; + + public BuilderImpl(final ODataServiceVersion version) { + super(version); + instance = new ODataPrimitiveValueImpl(); + } + + @Override + protected AbstractODataPrimitiveValue getInstance() { + return instance; + } + + @Override + public ODataPrimitiveValueImpl build() { + return (ODataPrimitiveValueImpl) super.build(); + } + + } + + @Override + public boolean isEnum() { + return false; + } + + @Override + public ODataEnumValue asEnum() { + return null; + } + + @Override + public boolean isLinkedComplex() { + return false; + } + + @Override + public ODataLinkedComplexValue asLinkedComplex() { + return null; + } + +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/111239d7/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPropertyImpl.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPropertyImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPropertyImpl.java new file mode 100644 index 0000000..e1560b3 --- /dev/null +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPropertyImpl.java @@ -0,0 +1,88 @@ +/* + * 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.commons.core.domain; + +import org.apache.olingo.commons.api.domain.ODataAnnotation; +import org.apache.olingo.commons.api.domain.ODataCollectionValue; +import org.apache.olingo.commons.api.domain.ODataComplexValue; +import org.apache.olingo.commons.api.domain.ODataEnumValue; +import org.apache.olingo.commons.api.domain.ODataLinkedComplexValue; +import org.apache.olingo.commons.api.domain.ODataProperty; +import org.apache.olingo.commons.api.domain.ODataValuable; +import org.apache.olingo.commons.api.domain.ODataValue; + +import java.util.ArrayList; +import java.util.List; + +public class ODataPropertyImpl extends AbstractODataProperty implements ODataProperty { + + private final ODataValuable valuable; + + private final List<ODataAnnotation> annotations = new ArrayList<ODataAnnotation>(); + + public ODataPropertyImpl(final String name, final org.apache.olingo.commons.api.domain.ODataValue value) { + super(name, value); + valuable = new ODataValuableImpl((ODataValue) value); + } + + @Override + public ODataValue getValue() { + return valuable.getValue(); + } + + @Override + public boolean hasEnumValue() { + return valuable.hasEnumValue(); + } + + @Override + public ODataEnumValue getEnumValue() { + return valuable.getEnumValue(); + } + + @Override + public ODataComplexValue<ODataProperty> getComplexValue() { + return valuable.getComplexValue(); + } + + @Override + public ODataLinkedComplexValue getLinkedComplexValue() { + return valuable.getLinkedComplexValue(); + } + + @Override + public ODataCollectionValue<ODataValue> getCollectionValue() { + return valuable.getCollectionValue(); + } + + @Override + public List<ODataAnnotation> getAnnotations() { + return annotations; + } + + @Override + public String toString() { + return "ODataPropertyImpl{" + + "name=" + getName() + + ",valuable=" + valuable + + ", annotations=" + annotations + + '}'; + } + +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/111239d7/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataValuableImpl.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataValuableImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataValuableImpl.java new file mode 100644 index 0000000..090a584 --- /dev/null +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataValuableImpl.java @@ -0,0 +1,120 @@ +/* + * 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.commons.core.domain; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ReflectionToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import org.apache.olingo.commons.api.domain.ODataCollectionValue; +import org.apache.olingo.commons.api.domain.ODataComplexValue; +import org.apache.olingo.commons.api.domain.ODataEnumValue; +import org.apache.olingo.commons.api.domain.ODataLinkedComplexValue; +import org.apache.olingo.commons.api.domain.ODataPrimitiveValue; +import org.apache.olingo.commons.api.domain.ODataProperty; +import org.apache.olingo.commons.api.domain.ODataValuable; +import org.apache.olingo.commons.api.domain.ODataValue; + +public class ODataValuableImpl implements ODataValuable { + + private final ODataValue value; + + public ODataValuableImpl(final ODataValue value) { + this.value = value; + } + + @Override + public ODataValue getValue() { + return value; + } + + @Override + public boolean hasNullValue() { + return value == null; + } + + @Override + public boolean hasPrimitiveValue() { + return !hasNullValue() && value.isPrimitive(); + } + + @Override + public ODataPrimitiveValue getPrimitiveValue() { + return hasPrimitiveValue() ? value.asPrimitive() : null; + } + + @Override + public boolean hasCollectionValue() { + return !hasNullValue() && value.isCollection(); + } + + @Override + public ODataCollectionValue<ODataValue> getCollectionValue() { + return hasCollectionValue() + ? getValue().<ODataValue> asCollection() + : null; + } + + @Override + public boolean hasComplexValue() { + return !hasNullValue() && value.isComplex(); + } + + @Override + public ODataComplexValue<ODataProperty> getComplexValue() { + return hasComplexValue() + ? getValue().<ODataProperty> asComplex() + : null; + } + + @Override + public ODataLinkedComplexValue getLinkedComplexValue() { + return hasComplexValue() + ? getValue().asLinkedComplex() + : null; + } + + @Override + public boolean hasEnumValue() { + return !hasNullValue() && getValue().isEnum(); + } + + @Override + public ODataEnumValue getEnumValue() { + return hasEnumValue() + ? getValue().asEnum() + : null; + } + + @Override + public boolean equals(final Object obj) { + return EqualsBuilder.reflectionEquals(this, obj); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE); + } + +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/111239d7/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataAnnotationImpl.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataAnnotationImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataAnnotationImpl.java deleted file mode 100644 index 436217c..0000000 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataAnnotationImpl.java +++ /dev/null @@ -1,109 +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.commons.core.domain.v4; - -import org.apache.olingo.commons.api.domain.ODataCollectionValue; -import org.apache.olingo.commons.api.domain.ODataComplexValue; -import org.apache.olingo.commons.api.domain.ODataPrimitiveValue; -import org.apache.olingo.commons.api.domain.v4.ODataAnnotation; -import org.apache.olingo.commons.api.domain.v4.ODataEnumValue; -import org.apache.olingo.commons.api.domain.v4.ODataLinkedComplexValue; -import org.apache.olingo.commons.api.domain.v4.ODataProperty; -import org.apache.olingo.commons.api.domain.v4.ODataValuable; -import org.apache.olingo.commons.api.domain.v4.ODataValue; - -public class ODataAnnotationImpl implements ODataAnnotation { - - private final String term; - - private final ODataValuable valuable; - - public ODataAnnotationImpl(final String term, final ODataValue value) { - this.term = term; - valuable = new ODataValuableImpl(value); - } - - @Override - public String getTerm() { - return term; - } - - @Override - public ODataValue getValue() { - return valuable.getValue(); - } - - @Override - public boolean hasNullValue() { - return valuable.hasNullValue(); - } - - @Override - public boolean hasPrimitiveValue() { - return valuable.hasPrimitiveValue(); - } - - @Override - public ODataPrimitiveValue getPrimitiveValue() { - return valuable.getPrimitiveValue(); - } - - @Override - public boolean hasCollectionValue() { - return valuable.hasCollectionValue(); - } - - @Override - public ODataCollectionValue<ODataValue> getCollectionValue() { - return valuable.getCollectionValue(); - } - - @Override - public boolean hasComplexValue() { - return valuable.hasComplexValue(); - } - - @Override - public ODataComplexValue<ODataProperty> getComplexValue() { - return valuable.getComplexValue(); - } - - @Override - public ODataLinkedComplexValue getLinkedComplexValue() { - return valuable.getLinkedComplexValue(); - } - - @Override - public boolean hasEnumValue() { - return valuable.hasEnumValue(); - } - - @Override - public ODataEnumValue getEnumValue() { - return valuable.getEnumValue(); - } - - @Override - public String toString() { - return "ODataPropertyImpl{" - + "term=" + term - + ",valuable=" + valuable - + '}'; - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/111239d7/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataCollectionValueImpl.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataCollectionValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataCollectionValueImpl.java deleted file mode 100644 index 6f29af3..0000000 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataCollectionValueImpl.java +++ /dev/null @@ -1,78 +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.commons.core.domain.v4; - -import org.apache.olingo.commons.api.domain.v4.ODataEnumValue; -import org.apache.olingo.commons.api.domain.v4.ODataLinkedComplexValue; -import org.apache.olingo.commons.api.domain.v4.ODataValue; -import org.apache.olingo.commons.core.domain.AbstractODataCollectionValue; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -public class ODataCollectionValueImpl extends AbstractODataCollectionValue<ODataValue> implements ODataValue { - - public ODataCollectionValueImpl(final String typeName) { - super(typeName); - } - - @Override - protected ODataCollectionValueImpl getThis() { - return this; - } - - @Override - public boolean isEnum() { - return false; - } - - @Override - public ODataEnumValue asEnum() { - return null; - } - - @Override - public boolean isLinkedComplex() { - return false; - } - - @Override - public ODataLinkedComplexValue asLinkedComplex() { - return null; - } - - @Override - public Collection<Object> asJavaCollection() { - final List<Object> result = new ArrayList<Object>(); - for (ODataValue value : values) { - if (value.isPrimitive()) { - result.add(value.asPrimitive().toValue()); - } else if (value.isComplex()) { - result.add(value.asComplex().asJavaMap()); - } else if (value.isCollection()) { - result.add(value.asCollection().asJavaCollection()); - } else if (value.isEnum()) { - result.add(value.asEnum().toString()); - } - } - - return result; - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/111239d7/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataComplexValueImpl.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataComplexValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataComplexValueImpl.java deleted file mode 100644 index 9a3ed7b..0000000 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataComplexValueImpl.java +++ /dev/null @@ -1,162 +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.commons.core.domain.v4; - -import org.apache.olingo.commons.api.domain.ODataComplexValue; -import org.apache.olingo.commons.api.domain.ODataLink; -import org.apache.olingo.commons.api.domain.v4.ODataAnnotation; -import org.apache.olingo.commons.api.domain.v4.ODataEnumValue; -import org.apache.olingo.commons.api.domain.v4.ODataLinkedComplexValue; -import org.apache.olingo.commons.api.domain.v4.ODataProperty; -import org.apache.olingo.commons.core.domain.AbstractODataComplexValue; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -public class ODataComplexValueImpl extends AbstractODataComplexValue<ODataProperty> implements ODataLinkedComplexValue { - - /** - * Navigation links (might contain in-line entities or entity sets). - */ - private final List<ODataLink> navigationLinks = new ArrayList<ODataLink>(); - - /** - * Association links. - */ - private final List<ODataLink> associationLinks = new ArrayList<ODataLink>(); - - private final List<ODataAnnotation> annotations = new ArrayList<ODataAnnotation>(); - - public ODataComplexValueImpl(final String typeName) { - super(typeName); - } - - @Override - protected ODataComplexValue<ODataProperty> getThis() { - return this; - } - - @Override - public boolean isEnum() { - return false; - } - - @Override - public ODataEnumValue asEnum() { - return null; - } - - @Override - public boolean isLinkedComplex() { - return true; - } - - @Override - public ODataLinkedComplexValue asLinkedComplex() { - return this; - } - - @Override - public boolean addLink(final ODataLink link) { - boolean result = false; - - switch (link.getType()) { - case ASSOCIATION: - result = associationLinks.contains(link) ? false : associationLinks.add(link); - break; - - case ENTITY_NAVIGATION: - case ENTITY_SET_NAVIGATION: - result = navigationLinks.contains(link) ? false : navigationLinks.add(link); - break; - - case MEDIA_EDIT: - throw new IllegalArgumentException("Complex values cannot have media links!"); - - default: - } - - return result; - } - - @Override - public boolean removeLink(final ODataLink link) { - return associationLinks.remove(link) || navigationLinks.remove(link); - } - - private ODataLink getLink(final List<ODataLink> links, final String name) { - ODataLink result = null; - for (ODataLink link : links) { - if (name.equals(link.getName())) { - result = link; - } - } - - return result; - } - - @Override - public ODataLink getNavigationLink(final String name) { - return getLink(navigationLinks, name); - } - - @Override - public List<ODataLink> getNavigationLinks() { - return navigationLinks; - } - - @Override - public ODataLink getAssociationLink(final String name) { - return getLink(associationLinks, name); - } - - @Override - public List<ODataLink> getAssociationLinks() { - return associationLinks; - } - - @Override - public Map<String, Object> asJavaMap() { - final Map<String, Object> result = new LinkedHashMap<String, Object>(); - for (Map.Entry<String, ODataProperty> entry : fields.entrySet()) { - Object value = null; - if (entry.getValue().hasPrimitiveValue()) { - value = entry.getValue().getPrimitiveValue().toValue(); - } else if (entry.getValue().hasComplexValue()) { - value = entry.getValue().getComplexValue().asJavaMap(); - } else if (entry.getValue().hasCollectionValue()) { - value = entry.getValue().getCollectionValue().asJavaCollection(); - } else if (entry.getValue().hasEnumValue()) { - value = entry.getValue().getEnumValue().toString(); - } - - result.put(entry.getKey(), value); - } - - return result; - } - - @Override - public List<ODataAnnotation> getAnnotations() { - return annotations; - } - -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/111239d7/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataDeletedEntityImpl.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataDeletedEntityImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataDeletedEntityImpl.java deleted file mode 100644 index 8722d7d..0000000 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataDeletedEntityImpl.java +++ /dev/null @@ -1,54 +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.commons.core.domain.v4; - -import org.apache.olingo.commons.api.domain.ODataItem; -import org.apache.olingo.commons.api.domain.v4.ODataDeletedEntity; - -import java.net.URI; - -public class ODataDeletedEntityImpl extends ODataItem implements ODataDeletedEntity { - - private URI id; - - private Reason reason; - - public ODataDeletedEntityImpl() { - super(null); - } - - @Override - public URI getId() { - return id; - } - - public void setId(final URI id) { - this.id = id; - } - - @Override - public Reason getReason() { - return reason; - } - - public void setReason(final Reason reason) { - this.reason = reason; - } - -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/111239d7/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataDeltaImpl.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataDeltaImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataDeltaImpl.java deleted file mode 100644 index 18e7655..0000000 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataDeltaImpl.java +++ /dev/null @@ -1,60 +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.commons.core.domain.v4; - -import org.apache.olingo.commons.api.domain.v4.ODataDeletedEntity; -import org.apache.olingo.commons.api.domain.v4.ODataDelta; -import org.apache.olingo.commons.api.domain.v4.ODataDeltaLink; - -import java.net.URI; -import java.util.ArrayList; -import java.util.List; - -public class ODataDeltaImpl extends ODataEntitySetImpl implements ODataDelta { - - private final List<ODataDeletedEntity> deletedEntities = new ArrayList<ODataDeletedEntity>(); - - private final List<ODataDeltaLink> addedLinks = new ArrayList<ODataDeltaLink>(); - - private final List<ODataDeltaLink> deletedLinks = new ArrayList<ODataDeltaLink>(); - - public ODataDeltaImpl() { - super(); - } - - public ODataDeltaImpl(final URI next) { - super(next); - } - - @Override - public List<ODataDeletedEntity> getDeletedEntities() { - return deletedEntities; - } - - @Override - public List<ODataDeltaLink> getAddedLinks() { - return addedLinks; - } - - @Override - public List<ODataDeltaLink> getDeletedLinks() { - return deletedLinks; - } - -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/111239d7/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataDeltaLinkImpl.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataDeltaLinkImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataDeltaLinkImpl.java deleted file mode 100644 index a0d18e6..0000000 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataDeltaLinkImpl.java +++ /dev/null @@ -1,78 +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.commons.core.domain.v4; - -import org.apache.olingo.commons.api.domain.ODataItem; -import org.apache.olingo.commons.api.domain.v4.ODataAnnotation; -import org.apache.olingo.commons.api.domain.v4.ODataDeltaLink; - -import java.net.URI; -import java.util.ArrayList; -import java.util.List; - -public class ODataDeltaLinkImpl extends ODataItem implements ODataDeltaLink { - - private URI source; - - private String relationship; - - private URI target; - - private final List<ODataAnnotation> annotations = new ArrayList<ODataAnnotation>(); - - public ODataDeltaLinkImpl() { - super(null); - } - - @Override - public URI getSource() { - return source; - } - - @Override - public void setSource(final URI source) { - this.source = source; - } - - @Override - public String getRelationship() { - return relationship; - } - - @Override - public void setRelationship(final String relationship) { - this.relationship = relationship; - } - - @Override - public URI getTarget() { - return target; - } - - @Override - public void setTarget(final URI target) { - this.target = target; - } - - @Override - public List<ODataAnnotation> getAnnotations() { - return annotations; - } - -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/111239d7/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEntityImpl.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEntityImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEntityImpl.java deleted file mode 100644 index 24063f4..0000000 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEntityImpl.java +++ /dev/null @@ -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.commons.core.domain.v4; - -import java.net.URI; -import java.util.ArrayList; -import java.util.List; - -import org.apache.olingo.commons.api.domain.v4.ODataAnnotation; -import org.apache.olingo.commons.api.domain.v4.ODataProperty; -import org.apache.olingo.commons.api.domain.v4.ODataSingleton; -import org.apache.olingo.commons.api.edm.FullQualifiedName; -import org.apache.olingo.commons.core.domain.AbstractODataEntity; - -public class ODataEntityImpl extends AbstractODataEntity implements ODataSingleton { - - /** - * Entity id. - */ - private URI id; - - private final List<ODataProperty> properties = new ArrayList<ODataProperty>(); - - private final List<ODataAnnotation> annotations = new ArrayList<ODataAnnotation>(); - - public ODataEntityImpl(final FullQualifiedName typeName) { - super(typeName); - } - - @Override - public URI getId() { - return id; - } - - @Override - public void setId(final URI id) { - this.id = id; - } - - @Override - public ODataProperty getProperty(final String name) { - return (ODataProperty) super.getProperty(name); - } - - @Override - public List<ODataProperty> getProperties() { - return properties; - } - - @Override - public List<ODataAnnotation> getAnnotations() { - return annotations; - } - -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/111239d7/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEntitySetImpl.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEntitySetImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEntitySetImpl.java deleted file mode 100644 index eda164e..0000000 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEntitySetImpl.java +++ /dev/null @@ -1,66 +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.commons.core.domain.v4; - -import org.apache.olingo.commons.api.domain.v4.ODataAnnotation; -import org.apache.olingo.commons.api.domain.v4.ODataEntity; -import org.apache.olingo.commons.api.domain.v4.ODataEntitySet; -import org.apache.olingo.commons.core.domain.AbstractODataEntitySet; - -import java.net.URI; -import java.util.ArrayList; -import java.util.List; - -public class ODataEntitySetImpl extends AbstractODataEntitySet implements ODataEntitySet { - - private URI deltaLink; - - private final List<ODataEntity> entities = new ArrayList<ODataEntity>(); - - private final List<ODataAnnotation> annotations = new ArrayList<ODataAnnotation>(); - - public ODataEntitySetImpl() { - super(); - } - - public ODataEntitySetImpl(final URI next) { - super(next); - } - - @Override - public List<ODataEntity> getEntities() { - return entities; - } - - @Override - public URI getDeltaLink() { - return deltaLink; - } - - @Override - public void setDeltaLink(final URI deltaLink) { - this.deltaLink = deltaLink; - } - - @Override - public List<ODataAnnotation> getAnnotations() { - return annotations; - } - -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/111239d7/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEnumValueImpl.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEnumValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEnumValueImpl.java deleted file mode 100644 index 52c8898..0000000 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEnumValueImpl.java +++ /dev/null @@ -1,65 +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.commons.core.domain.v4; - -import org.apache.olingo.commons.api.domain.AbstractODataValue; -import org.apache.olingo.commons.api.domain.v4.ODataEnumValue; -import org.apache.olingo.commons.api.domain.v4.ODataLinkedComplexValue; - -public class ODataEnumValueImpl extends AbstractODataValue implements ODataEnumValue { - - private final String value; - - public ODataEnumValueImpl(final String typeName, final String value) { - super(typeName); - this.value = value; - } - - @Override - public String getValue() { - return value; - } - - @Override - public boolean isEnum() { - return true; - } - - @Override - public ODataEnumValue asEnum() { - return this; - } - - @Override - public boolean isLinkedComplex() { - return false; - } - - @Override - public ODataLinkedComplexValue asLinkedComplex() { - return null; - } - - @Override - public String toString() { - return getTypeName() + "'" + getValue() + "'"; - - } - -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/111239d7/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataObjectFactoryImpl.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataObjectFactoryImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataObjectFactoryImpl.java deleted file mode 100644 index 6c3c79a..0000000 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataObjectFactoryImpl.java +++ /dev/null @@ -1,157 +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.commons.core.domain.v4; - -import org.apache.olingo.commons.api.domain.CommonODataProperty; -import org.apache.olingo.commons.api.domain.ODataCollectionValue; -import org.apache.olingo.commons.api.domain.ODataComplexValue; -import org.apache.olingo.commons.api.domain.ODataLinkType; -import org.apache.olingo.commons.api.domain.ODataPrimitiveValue; -import org.apache.olingo.commons.api.domain.v4.ODataDelta; -import org.apache.olingo.commons.api.domain.v4.ODataEntity; -import org.apache.olingo.commons.api.domain.v4.ODataEntitySet; -import org.apache.olingo.commons.api.domain.v4.ODataEnumValue; -import org.apache.olingo.commons.api.domain.v4.ODataLink; -import org.apache.olingo.commons.api.domain.v4.ODataLinkedComplexValue; -import org.apache.olingo.commons.api.domain.v4.ODataObjectFactory; -import org.apache.olingo.commons.api.domain.v4.ODataProperty; -import org.apache.olingo.commons.api.domain.v4.ODataSingleton; -import org.apache.olingo.commons.api.domain.v4.ODataValue; -import org.apache.olingo.commons.api.edm.FullQualifiedName; -import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; -import org.apache.olingo.commons.core.domain.AbstractODataObjectFactory; - -import java.net.URI; - -public class ODataObjectFactoryImpl extends AbstractODataObjectFactory implements ODataObjectFactory { - - public ODataObjectFactoryImpl(final ODataServiceVersion version) { - super(version); - } - - @Override - public ODataEntitySet newEntitySet() { - return new ODataEntitySetImpl(); - } - - @Override - public ODataEntitySet newEntitySet(final URI next) { - return new ODataEntitySetImpl(next); - } - - @Override - public ODataEntity newEntity(final FullQualifiedName typeName) { - return new ODataEntityImpl(typeName); - } - - @Override - public ODataEntity newEntity(final FullQualifiedName typeName, final URI link) { - final ODataEntityImpl result = new ODataEntityImpl(typeName); - result.setLink(link); - return result; - } - - @Override - public ODataSingleton newSingleton(final FullQualifiedName typeName) { - return new ODataEntityImpl(typeName); - } - - @Override - public ODataLink newEntityNavigationLink(final String name, final URI link) { - return new ODataLink.Builder().setVersion(version).setURI(link). - setType(ODataLinkType.ENTITY_NAVIGATION).setTitle(name).build(); - } - - @Override - public ODataLink newEntitySetNavigationLink(final String name, final URI link) { - return new ODataLink.Builder().setVersion(version).setURI(link). - setType(ODataLinkType.ENTITY_SET_NAVIGATION).setTitle(name).build(); - } - - @Override - public ODataLink newAssociationLink(final String name, final URI link) { - return new ODataLink.Builder().setVersion(version).setURI(link). - setType(ODataLinkType.ASSOCIATION).setTitle(name).build(); - } - - @Override - public ODataLink newMediaEditLink(final String name, final URI link) { - return new ODataLink.Builder().setVersion(version).setURI(link). - setType(ODataLinkType.MEDIA_EDIT).setTitle(name).build(); - } - - @Override - public ODataPrimitiveValue.Builder newPrimitiveValueBuilder() { - return new ODataPrimitiveValueImpl.BuilderImpl(version); - } - - @Override - public ODataEnumValue newEnumValue(final String typeName, final String value) { - return new ODataEnumValueImpl(typeName, value); - } - - @Override - public ODataComplexValue<ODataProperty> newComplexValue(final String typeName) { - return new ODataComplexValueImpl(typeName); - } - - @Override - public ODataLinkedComplexValue newLinkedComplexValue(final String typeName) { - return new ODataComplexValueImpl(typeName); - } - - @Override - public ODataCollectionValue<ODataValue> newCollectionValue(final String typeName) { - return new ODataCollectionValueImpl(typeName); - } - - @Override - public ODataProperty newPrimitiveProperty(final String name, final ODataPrimitiveValue value) { - return new ODataPropertyImpl(name, value); - } - - @Override - public ODataProperty newComplexProperty(final String name, - final ODataComplexValue<? extends CommonODataProperty> value) { - - return new ODataPropertyImpl(name, value); - } - - @Override - public ODataProperty newCollectionProperty(final String name, - final ODataCollectionValue<? extends org.apache.olingo.commons.api.domain.ODataValue> value) { - - return new ODataPropertyImpl(name, value); - } - - @Override - public ODataProperty newEnumProperty(final String name, final ODataEnumValue value) { - return new ODataPropertyImpl(name, value); - } - - @Override - public ODataDelta newDelta() { - return new ODataDeltaImpl(); - } - - @Override - public ODataDelta newDelta(final URI next) { - return new ODataDeltaImpl(next); - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/111239d7/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPrimitiveValueImpl.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPrimitiveValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPrimitiveValueImpl.java deleted file mode 100644 index 97f252d..0000000 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPrimitiveValueImpl.java +++ /dev/null @@ -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.commons.core.domain.v4; - -import org.apache.olingo.commons.api.domain.v4.ODataEnumValue; -import org.apache.olingo.commons.api.domain.v4.ODataLinkedComplexValue; -import org.apache.olingo.commons.api.domain.v4.ODataValue; -import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; -import org.apache.olingo.commons.core.domain.AbstractODataPrimitiveValue; - -public class ODataPrimitiveValueImpl extends AbstractODataPrimitiveValue implements ODataValue { - - public static class BuilderImpl extends AbstractBuilder { - - private final ODataPrimitiveValueImpl instance; - - public BuilderImpl(final ODataServiceVersion version) { - super(version); - instance = new ODataPrimitiveValueImpl(); - } - - @Override - protected AbstractODataPrimitiveValue getInstance() { - return instance; - } - - @Override - public ODataPrimitiveValueImpl build() { - return (ODataPrimitiveValueImpl) super.build(); - } - - } - - @Override - public boolean isEnum() { - return false; - } - - @Override - public ODataEnumValue asEnum() { - return null; - } - - @Override - public boolean isLinkedComplex() { - return false; - } - - @Override - public ODataLinkedComplexValue asLinkedComplex() { - return null; - } - -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/111239d7/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPropertyImpl.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPropertyImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPropertyImpl.java deleted file mode 100644 index 84a35dc..0000000 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPropertyImpl.java +++ /dev/null @@ -1,89 +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.commons.core.domain.v4; - -import org.apache.olingo.commons.api.domain.ODataCollectionValue; -import org.apache.olingo.commons.api.domain.ODataComplexValue; -import org.apache.olingo.commons.api.domain.v4.ODataAnnotation; -import org.apache.olingo.commons.api.domain.v4.ODataEnumValue; -import org.apache.olingo.commons.api.domain.v4.ODataLinkedComplexValue; -import org.apache.olingo.commons.api.domain.v4.ODataProperty; -import org.apache.olingo.commons.api.domain.v4.ODataValuable; -import org.apache.olingo.commons.api.domain.v4.ODataValue; -import org.apache.olingo.commons.core.domain.AbstractODataProperty; - -import java.util.ArrayList; -import java.util.List; - -public class ODataPropertyImpl extends AbstractODataProperty implements ODataProperty { - - private final ODataValuable valuable; - - private final List<ODataAnnotation> annotations = new ArrayList<ODataAnnotation>(); - - public ODataPropertyImpl(final String name, final org.apache.olingo.commons.api.domain.ODataValue value) { - super(name, value); - valuable = new ODataValuableImpl((ODataValue) value); - } - - @Override - public ODataValue getValue() { - return valuable.getValue(); - } - - @Override - public boolean hasEnumValue() { - return valuable.hasEnumValue(); - } - - @Override - public ODataEnumValue getEnumValue() { - return valuable.getEnumValue(); - } - - @Override - public ODataComplexValue<ODataProperty> getComplexValue() { - return valuable.getComplexValue(); - } - - @Override - public ODataLinkedComplexValue getLinkedComplexValue() { - return valuable.getLinkedComplexValue(); - } - - @Override - public ODataCollectionValue<ODataValue> getCollectionValue() { - return valuable.getCollectionValue(); - } - - @Override - public List<ODataAnnotation> getAnnotations() { - return annotations; - } - - @Override - public String toString() { - return "ODataPropertyImpl{" - + "name=" + getName() - + ",valuable=" + valuable - + ", annotations=" + annotations - + '}'; - } - -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/111239d7/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataValuableImpl.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataValuableImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataValuableImpl.java deleted file mode 100644 index 664691c..0000000 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataValuableImpl.java +++ /dev/null @@ -1,120 +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.commons.core.domain.v4; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ReflectionToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import org.apache.olingo.commons.api.domain.ODataCollectionValue; -import org.apache.olingo.commons.api.domain.ODataComplexValue; -import org.apache.olingo.commons.api.domain.ODataPrimitiveValue; -import org.apache.olingo.commons.api.domain.v4.ODataEnumValue; -import org.apache.olingo.commons.api.domain.v4.ODataLinkedComplexValue; -import org.apache.olingo.commons.api.domain.v4.ODataProperty; -import org.apache.olingo.commons.api.domain.v4.ODataValuable; -import org.apache.olingo.commons.api.domain.v4.ODataValue; - -public class ODataValuableImpl implements ODataValuable { - - private final ODataValue value; - - public ODataValuableImpl(final ODataValue value) { - this.value = value; - } - - @Override - public ODataValue getValue() { - return value; - } - - @Override - public boolean hasNullValue() { - return value == null; - } - - @Override - public boolean hasPrimitiveValue() { - return !hasNullValue() && value.isPrimitive(); - } - - @Override - public ODataPrimitiveValue getPrimitiveValue() { - return hasPrimitiveValue() ? value.asPrimitive() : null; - } - - @Override - public boolean hasCollectionValue() { - return !hasNullValue() && value.isCollection(); - } - - @Override - public ODataCollectionValue<ODataValue> getCollectionValue() { - return hasCollectionValue() - ? getValue().<ODataValue> asCollection() - : null; - } - - @Override - public boolean hasComplexValue() { - return !hasNullValue() && value.isComplex(); - } - - @Override - public ODataComplexValue<ODataProperty> getComplexValue() { - return hasComplexValue() - ? getValue().<ODataProperty> asComplex() - : null; - } - - @Override - public ODataLinkedComplexValue getLinkedComplexValue() { - return hasComplexValue() - ? getValue().asLinkedComplex() - : null; - } - - @Override - public boolean hasEnumValue() { - return !hasNullValue() && getValue().isEnum(); - } - - @Override - public ODataEnumValue getEnumValue() { - return hasEnumValue() - ? getValue().asEnum() - : null; - } - - @Override - public boolean equals(final Object obj) { - return EqualsBuilder.reflectionEquals(this, obj); - } - - @Override - public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public String toString() { - return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE); - } - -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/111239d7/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomDeserializer.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomDeserializer.java index 548063e..4431303 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomDeserializer.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomDeserializer.java @@ -61,13 +61,13 @@ import org.apache.olingo.commons.api.serialization.ODataDeserializerException; import org.apache.olingo.commons.core.data.AbstractODataObject; import org.apache.olingo.commons.core.data.AnnotationImpl; import org.apache.olingo.commons.core.data.DeletedEntityImpl; +import org.apache.olingo.commons.core.data.DeltaImpl; import org.apache.olingo.commons.core.data.DeltaLinkImpl; import org.apache.olingo.commons.core.data.EntityImpl; import org.apache.olingo.commons.core.data.EntitySetImpl; import org.apache.olingo.commons.core.data.LinkImpl; import org.apache.olingo.commons.core.data.LinkedComplexValueImpl; import org.apache.olingo.commons.core.data.PropertyImpl; -import org.apache.olingo.commons.core.data.v4.DeltaImpl; import org.apache.olingo.commons.core.edm.EdmTypeInfo; import com.fasterxml.aalto.stax.InputFactoryImpl; http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/111239d7/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonDeltaDeserializer.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonDeltaDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonDeltaDeserializer.java index a9d4fb4..037b436 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonDeltaDeserializer.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonDeltaDeserializer.java @@ -23,6 +23,7 @@ import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ObjectNode; + import org.apache.commons.lang3.StringUtils; import org.apache.olingo.commons.api.Constants; import org.apache.olingo.commons.api.data.ContextURL; @@ -31,8 +32,8 @@ import org.apache.olingo.commons.api.data.ResWrap; import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; import org.apache.olingo.commons.api.serialization.ODataDeserializerException; import org.apache.olingo.commons.core.data.DeletedEntityImpl; +import org.apache.olingo.commons.core.data.DeltaImpl; import org.apache.olingo.commons.core.data.DeltaLinkImpl; -import org.apache.olingo.commons.core.data.v4.DeltaImpl; import java.io.IOException; import java.io.InputStream;
