[OLINGO-264] Adding data and domain objects for instance annotations

This commit is contained in:
Francesco Chicchiriccò 2014-05-06 10:32:34 +02:00
parent dda7577fa9
commit 70cdaef515
33 changed files with 455 additions and 84 deletions

View File

@ -114,7 +114,7 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
if (next != null) {
entitySet.setNext(next);
}
for (CommonODataEntity entity : odataEntitySet.getEntities()) {
entitySet.getEntities().add(getEntity(entity, ResourceFactory.entityClassForEntitySet(reference)));
}
@ -409,13 +409,11 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
}
for (Link link : resource.getPayload().getAssociationLinks()) {
entity.addLink(new ODataLink.Builder().setVersion(client.getServiceVersion()).
setURI(URIUtils.getURI(base, link.getHref())).
setType(ODataLinkType.ASSOCIATION).setTitle(link.getTitle()).build());
entity.addLink(client.getObjectFactory().
newAssociationLink(link.getTitle(), URIUtils.getURI(base, link.getHref())));
}
odataNavigationLinks(
edmType, resource.getPayload(), entity, resource.getMetadataETag(), base);
odataNavigationLinks(edmType, resource.getPayload(), entity, resource.getMetadataETag(), base);
for (Link link : resource.getPayload().getMediaEditLinks()) {
entity.addLink(new ODataLink.Builder().setVersion(client.getServiceVersion()).

View File

@ -0,0 +1,29 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.commons.api.data;
import java.util.List;
/**
* An element with instance annotations.
*/
public interface Annotatable {
List<Annotation> getAnnotations();
}

View File

@ -0,0 +1,37 @@
/*
* 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.api.data;
/**
* Represents an instance annotation.
*/
public interface Annotation {
String getTerm();
void setTerm(String term);
String getType();
void setType(String type);
Value getValue();
void setValue(Value value);
}

View File

@ -22,7 +22,7 @@ import org.apache.olingo.commons.api.domain.ODataOperation;
import java.net.URI;
import java.util.List;
public interface Entity extends Linked {
public interface Entity extends Linked, Annotatable {
/**
* Gets ETag.

View File

@ -21,7 +21,7 @@ package org.apache.olingo.commons.api.data;
import java.net.URI;
import java.util.List;
public interface EntitySet {
public interface EntitySet extends Annotatable {
/**
* Gets base URI.

View File

@ -18,7 +18,7 @@
*/
package org.apache.olingo.commons.api.data;
public interface Link {
public interface Link extends Annotatable {
/**
* Gets rel info.

View File

@ -16,9 +16,8 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.commons.api.data;
public interface LinkedComplexValue extends ComplexValue, Linked {
public interface LinkedComplexValue extends ComplexValue, Linked, Annotatable {
}

View File

@ -18,7 +18,7 @@
*/
package org.apache.olingo.commons.api.data;
public interface Property {
public interface Property extends Annotatable {
String getName();

View File

@ -94,6 +94,10 @@ public interface CommonODataObjectFactory {
*/
ODataLink newEntityNavigationLink(String name, URI link);
ODataLink newAssociationLink(String name, URI link);
ODataLink newMediaEditLink(String name, URI link);
ODataPrimitiveValue.Builder newPrimitiveValueBuilder();
ODataComplexValue<? extends CommonODataProperty> newComplexValue(String typeName);

View File

@ -81,25 +81,16 @@ public abstract class ODataItem implements Serializable {
this.link = link;
}
/**
* {@inheritDoc }
*/
@Override
public boolean equals(final Object obj) {
return EqualsBuilder.reflectionEquals(this, obj);
}
/**
* {@inheritDoc }
*/
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
/**
* {@inheritDoc }
*/
@Override
public String toString() {
return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);

View File

@ -30,15 +30,13 @@ public class ODataLink extends ODataItem {
public static class Builder {
private ODataServiceVersion version;
protected ODataServiceVersion version;
private URI uri;
protected URI uri;
private ODataLinkType type;
protected ODataLinkType type;
private String title;
private String mediaETag;
protected String title;
public Builder setVersion(final ODataServiceVersion version) {
this.version = version;
@ -65,14 +63,8 @@ public class ODataLink extends ODataItem {
return this;
}
public void setMediaETag(final String mediaETag) {
this.mediaETag = mediaETag;
}
public ODataLink build() {
final ODataLink instance = new ODataLink(version, uri, type, title);
instance.mediaETag = this.mediaETag;
return instance;
return new ODataLink(version, uri, type, title);
}
}
@ -111,7 +103,7 @@ public class ODataLink extends ODataItem {
/**
* ETag for media edit links.
*/
private String mediaETag;
protected String mediaETag;
/**
* Constructor.

View File

@ -0,0 +1,26 @@
/*
* 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.api.domain.v4;
import java.util.List;
public interface ODataAnnotatatable {
List<ODataAnnotation> getAnnotations();
}

View File

@ -0,0 +1,103 @@
/*
* 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.api.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;
public interface ODataAnnotation {
/**
* Returns annotation name.
*
* @return annotation name.
*/
String getTerm();
/**
* Returns annotation value.
*
* @return annotation value.
*/
ODataValue getValue();
/**
* Checks if has null value.
*
* @return 'TRUE' if has null value; 'FALSE' otherwise.
*/
boolean hasNullValue();
/**
* Checks if has primitive value.
*
* @return 'TRUE' if has primitive value; 'FALSE' otherwise.
*/
boolean hasPrimitiveValue();
/**
* Gets primitive value.
*
* @return primitive value if exists; null otherwise.
*/
ODataPrimitiveValue getPrimitiveValue();
/**
* Checks if has collection value.
*
* @return 'TRUE' if has collection value; 'FALSE' otherwise.
*/
boolean hasCollectionValue();
/**
* Gets collection value.
*
* @return collection value if exists; null otherwise.
*/
ODataCollectionValue<ODataValue> getCollectionValue();
/**
* Checks if has complex value.
*
* @return 'TRUE' if has complex value; 'FALSE' otherwise.
*/
boolean hasComplexValue();
/**
* Gets complex value.
*
* @return complex value if exists; null otherwise.
*/
ODataComplexValue<ODataProperty> getComplexValue();
/**
* Checks if has enum value.
*
* @return 'TRUE' if has enum value; 'FALSE' otherwise.
*/
boolean hasEnumValue();
/**
* Gets enum value.
*
* @return enum value if exists; null otherwise.
*/
ODataEnumValue getEnumValue();
}

View File

@ -21,7 +21,7 @@ package org.apache.olingo.commons.api.domain.v4;
import java.util.List;
import org.apache.olingo.commons.api.domain.CommonODataEntity;
public interface ODataEntity extends CommonODataEntity {
public interface ODataEntity extends CommonODataEntity, ODataAnnotatatable {
@Override
ODataProperty getProperty(String name);

View File

@ -22,7 +22,7 @@ import java.net.URI;
import java.util.List;
import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
public interface ODataEntitySet extends CommonODataEntitySet {
public interface ODataEntitySet extends CommonODataEntitySet, ODataAnnotatatable {
@Override
List<ODataEntity> getEntities();

View File

@ -0,0 +1,74 @@
/*
* 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.api.domain.v4;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import org.apache.olingo.commons.api.domain.ODataLinkType;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
public class ODataLink extends org.apache.olingo.commons.api.domain.ODataLink implements ODataAnnotatatable {
private static final long serialVersionUID = 8953805653775734101L;
public static class Builder extends org.apache.olingo.commons.api.domain.ODataLink.Builder {
@Override
public Builder setVersion(final ODataServiceVersion version) {
super.setVersion(version);
return this;
}
@Override
public Builder setURI(final URI uri) {
super.setURI(uri);
return this;
}
@Override
public Builder setType(final ODataLinkType type) {
super.setType(type);
return this;
}
@Override
public Builder setTitle(final String title) {
super.setTitle(title);
return this;
}
@Override
public ODataLink build() {
return new ODataLink(version, uri, type, title);
}
}
private final List<ODataAnnotation> annotations = new ArrayList<ODataAnnotation>();
public ODataLink(final ODataServiceVersion version, final URI uri, final ODataLinkType type, final String title) {
super(version, uri, type, title);
}
@Override
public List<ODataAnnotation> getAnnotations() {
return annotations;
}
}

View File

@ -21,6 +21,7 @@ package org.apache.olingo.commons.api.domain.v4;
import org.apache.olingo.commons.api.domain.ODataComplexValue;
import org.apache.olingo.commons.api.domain.ODataLinked;
public interface ODataLinkedComplexValue extends ODataValue, ODataLinked, ODataComplexValue<ODataProperty> {
public interface ODataLinkedComplexValue
extends ODataValue, ODataLinked, ODataComplexValue<ODataProperty>, ODataAnnotatatable {
}

View File

@ -40,6 +40,18 @@ public interface ODataObjectFactory extends CommonODataObjectFactory {
@Override
ODataEntity newEntity(FullQualifiedName typeName, URI link);
@Override
ODataLink newEntitySetNavigationLink(String name, URI link);
@Override
ODataLink newEntityNavigationLink(String name, URI link);
@Override
ODataLink newAssociationLink(String name, URI link);
@Override
ODataLink newMediaEditLink(String name, URI link);
ODataEnumValue newEnumValue(String typeName, String value);
@Override

View File

@ -22,7 +22,7 @@ import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.domain.ODataCollectionValue;
import org.apache.olingo.commons.api.domain.ODataComplexValue;
public interface ODataProperty extends CommonODataProperty {
public interface ODataProperty extends CommonODataProperty, ODataAnnotatatable {
/**
* Gets collection value.

View File

@ -0,0 +1,37 @@
/*
* 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.data;
import java.util.ArrayList;
import java.util.List;
import org.apache.olingo.commons.api.data.Annotatable;
import org.apache.olingo.commons.api.data.Annotation;
public abstract class AbstractAnnotatedObject extends AbstractPayloadObject implements Annotatable {
private static final long serialVersionUID = 4163841499530412213L;
private final List<Annotation> annotations = new ArrayList<Annotation>();
@Override
public List<Annotation> getAnnotations() {
return annotations;
}
}

View File

@ -23,7 +23,7 @@ import java.net.URI;
import java.text.ParseException;
import java.util.Date;
abstract class AbstractODataObject extends AbstractPayloadObject {
abstract class AbstractODataObject extends AbstractAnnotatedObject {
private static final long serialVersionUID = -4391162864875546927L;

View File

@ -18,14 +18,10 @@
*/
package org.apache.olingo.commons.core.data;
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.data.Property;
import org.apache.olingo.commons.api.data.Value;
public abstract class AbstractProperty implements Property {
public abstract class AbstractProperty extends AbstractAnnotatedObject implements Property {
private String name;
@ -62,19 +58,4 @@ public abstract class AbstractProperty implements Property {
public void setValue(final Value value) {
this.value = value;
}
@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);
}
}

View File

@ -22,7 +22,7 @@ import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.EntitySet;
import org.apache.olingo.commons.api.data.Link;
public class LinkImpl extends AbstractPayloadObject implements Link {
public class LinkImpl extends AbstractAnnotatedObject implements Link {
private static final long serialVersionUID = -3449344217160035501L;

View File

@ -20,6 +20,7 @@ package org.apache.olingo.commons.core.data;
import java.util.ArrayList;
import java.util.List;
import org.apache.olingo.commons.api.data.Annotation;
import org.apache.olingo.commons.api.data.Link;
import org.apache.olingo.commons.api.data.LinkedComplexValue;
@ -29,6 +30,8 @@ public class LinkedComplexValueImpl extends ComplexValueImpl implements LinkedCo
private final List<Link> navigationLinks = new ArrayList<Link>();
private final List<Annotation> annotations = new ArrayList<Annotation>();
@Override
public boolean isLinkedComplex() {
return true;
@ -44,4 +47,8 @@ public class LinkedComplexValueImpl extends ComplexValueImpl implements LinkedCo
return navigationLinks;
}
@Override
public List<Annotation> getAnnotations() {
return annotations;
}
}

View File

@ -18,13 +18,11 @@
*/
package org.apache.olingo.commons.core.domain;
import java.net.URI;
import org.apache.olingo.commons.api.domain.ODataLinkType;
import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.commons.api.domain.ODataInlineEntity;
import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
import org.apache.olingo.commons.api.domain.ODataLink;
import org.apache.olingo.commons.api.domain.CommonODataObjectFactory;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
@ -47,16 +45,4 @@ public abstract class AbstractODataObjectFactory implements CommonODataObjectFac
public ODataInlineEntity newDeepInsertEntity(final String name, final CommonODataEntity entity) {
return new ODataInlineEntity(version, null, ODataLinkType.ENTITY_NAVIGATION, name, entity);
}
@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();
}
}

View File

@ -67,6 +67,30 @@ public class ODataObjectFactoryImpl extends AbstractODataObjectFactory implement
return new ODataLink.Builder().setVersion(version).setURI(link).setType(ODataLinkType.ASSOCIATION).build();
}
@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);

View File

@ -24,6 +24,7 @@ import java.util.List;
import java.util.Map;
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.ODataLinkedComplexValue;
import org.apache.olingo.commons.api.domain.v4.ODataEnumValue;
import org.apache.olingo.commons.api.domain.v4.ODataProperty;
@ -43,6 +44,8 @@ public class ODataComplexValueImpl extends AbstractODataComplexValue<ODataProper
*/
private final List<ODataLink> associationLinks = new ArrayList<ODataLink>();
private final List<ODataAnnotation> annotations = new ArrayList<ODataAnnotation>();
public ODataComplexValueImpl(final String typeName) {
super(typeName);
}
@ -151,4 +154,10 @@ public class ODataComplexValueImpl extends AbstractODataComplexValue<ODataProper
return result;
}
@Override
public List<ODataAnnotation> getAnnotations() {
return annotations;
}
}

View File

@ -19,10 +19,10 @@
package org.apache.olingo.commons.core.domain.v4;
import java.net.URI;
import org.apache.olingo.commons.api.domain.ODataItem;
import org.apache.olingo.commons.api.domain.v4.ODataDeletedEntity;
import org.apache.olingo.commons.core.data.AbstractPayloadObject;
public class ODataDeletedEntityImpl extends AbstractPayloadObject implements ODataDeletedEntity {
public class ODataDeletedEntityImpl extends ODataItem implements ODataDeletedEntity {
private static final long serialVersionUID = -3841730551749114664L;
@ -30,6 +30,10 @@ public class ODataDeletedEntityImpl extends AbstractPayloadObject implements ODa
private Reason reason;
public ODataDeletedEntityImpl() {
super(null);
}
@Override
public URI getId() {
return id;

View File

@ -19,10 +19,10 @@
package org.apache.olingo.commons.core.domain.v4;
import java.net.URI;
import org.apache.olingo.commons.api.domain.ODataItem;
import org.apache.olingo.commons.api.domain.v4.ODataDeltaLink;
import org.apache.olingo.commons.core.data.AbstractPayloadObject;
public class ODataDeltaLinkImpl extends AbstractPayloadObject implements ODataDeltaLink {
public class ODataDeltaLinkImpl extends ODataItem implements ODataDeltaLink {
private static final long serialVersionUID = -6686550836508873044L;
@ -32,6 +32,10 @@ public class ODataDeltaLinkImpl extends AbstractPayloadObject implements ODataDe
private URI target;
public ODataDeltaLinkImpl() {
super(null);
}
@Override
public URI getSource() {
return source;
@ -48,7 +52,7 @@ public class ODataDeltaLinkImpl extends AbstractPayloadObject implements ODataDe
}
@Override
public void setRelationship(String relationship) {
public void setRelationship(final String relationship) {
this.relationship = relationship;
}
@ -58,7 +62,7 @@ public class ODataDeltaLinkImpl extends AbstractPayloadObject implements ODataDe
}
@Override
public void setTarget(URI target) {
public void setTarget(final URI target) {
this.target = target;
}

View File

@ -20,6 +20,7 @@ package org.apache.olingo.commons.core.domain.v4;
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.ODataEntity;
import org.apache.olingo.commons.api.domain.v4.ODataProperty;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
@ -36,6 +37,8 @@ public class ODataEntityImpl extends AbstractODataEntity implements ODataEntity
private final List<ODataProperty> properties = new ArrayList<ODataProperty>();
private final List<ODataAnnotation> annotations = new ArrayList<ODataAnnotation>();
public ODataEntityImpl(final FullQualifiedName typeName) {
super(typeName);
}
@ -60,4 +63,9 @@ public class ODataEntityImpl extends AbstractODataEntity implements ODataEntity
return properties;
}
@Override
public List<ODataAnnotation> getAnnotations() {
return annotations;
}
}

View File

@ -21,6 +21,7 @@ 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.ODataEntity;
import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
import org.apache.olingo.commons.core.domain.AbstractODataEntitySet;
@ -29,11 +30,14 @@ public class ODataEntitySetImpl extends AbstractODataEntitySet implements ODataE
private static final long serialVersionUID = -8127933181196033586L;
private final List<ODataEntity> entities = new ArrayList<ODataEntity>();
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) {
@ -59,4 +63,10 @@ public class ODataEntitySetImpl extends AbstractODataEntitySet implements ODataE
public void setDeltaLink(final URI deltaLink) {
this.deltaLink = deltaLink;
}
@Override
public List<ODataAnnotation> getAnnotations() {
return annotations;
}
}

View File

@ -22,12 +22,14 @@ import java.net.URI;
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.ODataEntitySet;
import org.apache.olingo.commons.api.domain.v4.ODataObjectFactory;
import org.apache.olingo.commons.api.domain.v4.ODataEntity;
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.ODataProperty;
import org.apache.olingo.commons.api.domain.v4.ODataValue;
@ -63,6 +65,30 @@ public class ODataObjectFactoryImpl extends AbstractODataObjectFactory implement
return result;
}
@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);

View File

@ -18,8 +18,11 @@
*/
package org.apache.olingo.commons.core.domain.v4;
import java.util.ArrayList;
import java.util.List;
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;
@ -30,6 +33,8 @@ public class ODataPropertyImpl extends AbstractODataProperty implements ODataPro
private static final long serialVersionUID = 4851331227420757747L;
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);
}
@ -68,4 +73,8 @@ public class ODataPropertyImpl extends AbstractODataProperty implements ODataPro
: null;
}
@Override
public List<ODataAnnotation> getAnnotations() {
return annotations;
}
}