[OLINGO-575] Cleanup of TODOs
This commit is contained in:
parent
5cef4faeb6
commit
3b37d29948
|
@ -91,7 +91,6 @@ public abstract class AbstractService<C extends EdmEnabledODataClient> {
|
|||
}else{
|
||||
edm = null;
|
||||
}
|
||||
// TODO: check runtime exception or not
|
||||
if (version.compareTo(ODataServiceVersion.V40) < 0) {
|
||||
throw new ODataRuntimeException("Only OData V4 or higher supported.");
|
||||
}
|
||||
|
|
|
@ -210,16 +210,7 @@ abstract class AbstractInvocationHandler implements InvocationHandler {
|
|||
final String containerNS, final String entitySetName, final AbstractService<?> service) {
|
||||
|
||||
final URIBuilder uriBuilder = service.getClient().newURIBuilder();
|
||||
// final Edm edm = service.getClient().getCachedEdm();
|
||||
|
||||
final StringBuilder entitySetSegment = new StringBuilder();
|
||||
//TODO: Container is always default in v4
|
||||
// if (StringUtils.isNotBlank(containerNS)) {
|
||||
// final EdmEntityContainer container = edm.getEntityContainer(new FullQualifiedName(containerNS));
|
||||
// if (!container.isDefault()) {
|
||||
// entitySetSegment.append(container.getFullQualifiedName().toString()).append('.');
|
||||
// }
|
||||
// }
|
||||
|
||||
entitySetSegment.append(entitySetName);
|
||||
uriBuilder.appendEntitySetSegment(entitySetSegment.toString());
|
||||
|
|
|
@ -651,25 +651,9 @@ public final class CoreUtils {
|
|||
return mediaEditLink == null ? URIUtils.getURI(entity.getEditLink(), name) : mediaEditLink.getLink();
|
||||
}
|
||||
|
||||
public static URI getTargetEntitySetURI(
|
||||
final EdmEnabledODataClient client, final NavigationProperty property) {
|
||||
// final Edm edm = client.getCachedEdm();
|
||||
//
|
||||
// final FullQualifiedName containerName =
|
||||
// new FullQualifiedName(property.targetSchema(), property.targetContainer());
|
||||
|
||||
// final EdmEntityContainer container = edm.getEntityContainer(containerName);
|
||||
public static URI getTargetEntitySetURI(final EdmEnabledODataClient client, final NavigationProperty property) {
|
||||
final URIBuilder uriBuilder = client.newURIBuilder(client.getServiceRoot());
|
||||
//TODO: Container can only be default in V4
|
||||
// if (!container.isDefault()) {
|
||||
// final StringBuilder entitySetSegment = new StringBuilder();
|
||||
// entitySetSegment.append(container.getFullQualifiedName()).append('.');
|
||||
// entitySetSegment.append(property.targetEntitySet());
|
||||
// uriBuilder.appendEntitySetSegment(entitySetSegment.toString());
|
||||
// } else {
|
||||
uriBuilder.appendEntitySetSegment(property.targetEntitySet());
|
||||
// }
|
||||
|
||||
uriBuilder.appendEntitySetSegment(property.targetEntitySet());
|
||||
return uriBuilder.build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,11 +18,7 @@
|
|||
*/
|
||||
package org.apache.olingo.client.core.edm.xml;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.olingo.commons.api.edm.provider.Annotation;
|
||||
import org.apache.olingo.commons.api.edm.provider.annotation.AnnotationExpression;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
|
||||
|
@ -31,46 +27,4 @@ public class AnnotationImpl extends Annotation {
|
|||
|
||||
private static final long serialVersionUID = 5464714417411058033L;
|
||||
|
||||
private String term;
|
||||
|
||||
private String qualifier;
|
||||
|
||||
private AnnotationExpression annotationExpression;
|
||||
|
||||
private final List<Annotation> annotations = new ArrayList<Annotation>();
|
||||
|
||||
@Override
|
||||
public List<Annotation> getAnnotations() {
|
||||
return annotations;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTerm() {
|
||||
return term;
|
||||
}
|
||||
|
||||
public AnnotationImpl setTerm(final String term) {
|
||||
this.term = term;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQualifier() {
|
||||
return qualifier;
|
||||
}
|
||||
|
||||
public AnnotationImpl setQualifier(final String qualifier) {
|
||||
this.qualifier = qualifier;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnnotationExpression getExpression() {
|
||||
return annotationExpression;
|
||||
}
|
||||
|
||||
public void setAnnotationExpression(final AnnotationExpression annotationExpression) {
|
||||
this.annotationExpression = annotationExpression;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -223,7 +223,6 @@ public class MetadataTest extends AbstractTest {
|
|||
final Function productsByRating = metadata.getSchema(0).getFunctions("ProductsByRating").get(0);
|
||||
assertNotNull(productsByRating.getParameter("Rating"));
|
||||
assertEquals("Edm.Int32", productsByRating.getParameter("Rating").getType());
|
||||
// assertEquals("Collection(ODataDemo.Product)", productsByRating.getReturnType().getType());
|
||||
assertEquals("ODataDemo.Product", productsByRating.getReturnType().getType());
|
||||
assertTrue(productsByRating.getReturnType().isCollection());
|
||||
|
||||
|
|
|
@ -63,5 +63,10 @@ public interface EdmOperation extends EdmType, EdmAnnotatable {
|
|||
* @return true if binding parameter is of type collection.
|
||||
*/
|
||||
Boolean isBindingParameterTypeCollection();
|
||||
|
||||
/**
|
||||
* @return the entity set path as a String or null if not present
|
||||
*/
|
||||
String getEntitySetPath();
|
||||
|
||||
}
|
||||
|
|
|
@ -18,23 +18,30 @@
|
|||
*/
|
||||
package org.apache.olingo.commons.api.edm.provider;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.olingo.commons.api.edm.provider.annotation.AnnotationExpression;
|
||||
|
||||
public class Annotation extends AbstractEdmItem implements Annotatable{
|
||||
public class Annotation extends AbstractEdmItem implements Annotatable {
|
||||
|
||||
private static final long serialVersionUID = -7137313445729486860L;
|
||||
|
||||
private String term;
|
||||
|
||||
// Target should be a target path
|
||||
// private String targetPath;
|
||||
private String qualifier;
|
||||
|
||||
private AnnotationExpression expression;
|
||||
private List<Annotation> annotation = new ArrayList<Annotation>();
|
||||
|
||||
private List<Annotation> annotation;
|
||||
private AnnotationExpression annotationExpression;
|
||||
|
||||
public AnnotationExpression getExpression() {
|
||||
return annotationExpression;
|
||||
}
|
||||
|
||||
public void setAnnotationExpression(final AnnotationExpression annotationExpression) {
|
||||
this.annotationExpression = annotationExpression;
|
||||
}
|
||||
|
||||
public String getTerm() {
|
||||
return term;
|
||||
|
@ -54,27 +61,17 @@ public class Annotation extends AbstractEdmItem implements Annotatable{
|
|||
return this;
|
||||
}
|
||||
|
||||
public AnnotationExpression getExpression() {
|
||||
return expression;
|
||||
}
|
||||
// public List<Annotation> getAnnotation() {
|
||||
// return annotation;
|
||||
// }
|
||||
|
||||
public Annotation setExpression(final AnnotationExpression expression) {
|
||||
this.expression = expression;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<Annotation> getAnnotation() {
|
||||
return annotation;
|
||||
}
|
||||
|
||||
public Annotation setAnnotation(final List<Annotation> annotation) {
|
||||
public Annotation setAnnotations(final List<Annotation> annotation) {
|
||||
this.annotation = annotation;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Annotation> getAnnotations() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
return annotation;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,7 +55,6 @@ public class EnumType extends AbstractEdmItem implements Named, Annotatable {
|
|||
return this;
|
||||
}
|
||||
|
||||
//TODO: Underlying type has a default
|
||||
public String getUnderlyingType() {
|
||||
if(underlyingType != null){
|
||||
return underlyingType.getFullQualifiedNameAsString();
|
||||
|
|
|
@ -34,7 +34,6 @@ public class Property extends AbstractEdmItem implements Named, Annotatable{
|
|||
|
||||
private boolean collection;
|
||||
|
||||
// TODO: Mimetype and mapping what here
|
||||
private String mimeType;
|
||||
|
||||
private Mapping mapping;
|
||||
|
|
|
@ -60,6 +60,6 @@ public class PropertyImpl extends AbstractValuable implements Property {
|
|||
|
||||
@Override
|
||||
public boolean isNull() {
|
||||
return getValue() == null || "Edm.Null".equals(type); // TODO: improve
|
||||
return getValue() == null || "Edm.Null".equals(type);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -96,4 +96,9 @@ public abstract class EdmOperationImpl extends AbstractEdmOperation {
|
|||
public List<EdmAnnotation> getAnnotations() {
|
||||
return helper.getAnnotations();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEntitySetPath(){
|
||||
return operation.getEntitySetPath();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -340,7 +340,7 @@ public class EdmProviderImpl extends AbstractEdm {
|
|||
}
|
||||
}
|
||||
|
||||
//TODO: Check implementation
|
||||
//TODO: Check Provider annotations implementation
|
||||
@Override
|
||||
protected EdmAnnotations createAnnotationGroup(final FullQualifiedName targetName) {
|
||||
try {
|
||||
|
|
|
@ -49,7 +49,6 @@ public interface FixedFormatSerializer {
|
|||
InputStream primitiveValue(EdmPrimitiveType type, Object value, PrimitiveValueSerializerOptions options)
|
||||
throws SerializerException;
|
||||
|
||||
// TODO: Return type
|
||||
/**
|
||||
* Serializes a batch response
|
||||
* @param batchResponses
|
||||
|
|
|
@ -185,7 +185,6 @@ public class BatchParserCommon {
|
|||
|
||||
public static void consumeBlankLine(final List<Line> remainingMessage, final boolean isStrict)
|
||||
throws BatchDeserializerException {
|
||||
// TODO is \r\n to strict?
|
||||
if (remainingMessage.size() > 0 && remainingMessage.get(0).toString().matches("\\s*(\r\n|\n)\\s*")) {
|
||||
remainingMessage.remove(0);
|
||||
} else {
|
||||
|
|
|
@ -60,7 +60,7 @@ public class FixedFormatSerializerImpl implements FixedFormatSerializer {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: Signature
|
||||
// TODO: Signature refactoring for writeBatchResponse
|
||||
@Override
|
||||
public InputStream batchResponse(final List<ODataResponsePart> batchResponses, final String boundary)
|
||||
throws BatchSerializerException {
|
||||
|
|
|
@ -79,7 +79,6 @@ public class ODataJsonSerializer implements ODataSerializer {
|
|||
CircleStreamBuffer buffer;
|
||||
JsonGenerator gen = null;
|
||||
|
||||
// TODO: move stream initialization into separate method
|
||||
try {
|
||||
buffer = new CircleStreamBuffer();
|
||||
gen = new JsonFactory().createGenerator(buffer.getOutputStream())
|
||||
|
@ -89,10 +88,6 @@ public class ODataJsonSerializer implements ODataSerializer {
|
|||
|
||||
gen.close();
|
||||
|
||||
// TODO: Check correct stream handling
|
||||
// writer.flush();
|
||||
// buffer.closeWrite();
|
||||
|
||||
return buffer.getInputStream();
|
||||
|
||||
} catch (final IOException e) {
|
||||
|
|
|
@ -116,6 +116,7 @@ public class MetadataDocumentXmlSerializer {
|
|||
private final static String NS_EDMX = "http://docs.oasis-open.org/odata/ns/edmx";
|
||||
|
||||
private final static String NS_EDM = "http://docs.oasis-open.org/odata/ns/edm";
|
||||
private static final String XML_ENTITY_SET_PATH = "EntitySetPath";
|
||||
|
||||
private final ServiceMetadata serviceMetadata;
|
||||
private final Map<String, String> namespaceToAlias = new HashMap<String, String>();
|
||||
|
@ -124,6 +125,8 @@ public class MetadataDocumentXmlSerializer {
|
|||
this.serviceMetadata = serviceMetadata;
|
||||
}
|
||||
|
||||
// TODO: Annotations in metadata document
|
||||
|
||||
public void writeMetadataDocument(final XMLStreamWriter writer) throws XMLStreamException {
|
||||
writer.writeStartDocument(ODataSerializer.DEFAULT_CHARSET, "1.0");
|
||||
writer.setPrefix(PREFIX_EDMX, NS_EDMX);
|
||||
|
@ -247,7 +250,7 @@ public class MetadataDocumentXmlSerializer {
|
|||
for (EdmFunctionImport functionImport : functionImports) {
|
||||
writer.writeStartElement(XML_FUNCTION_IMPORT);
|
||||
writer.writeAttribute(XML_NAME, functionImport.getName());
|
||||
|
||||
|
||||
String functionFQNString;
|
||||
FullQualifiedName functionFqn = functionImport.getFunctionFqn();
|
||||
if (namespaceToAlias.get(functionFqn.getNamespace()) != null) {
|
||||
|
@ -256,14 +259,13 @@ public class MetadataDocumentXmlSerializer {
|
|||
functionFQNString = functionFqn.getFullQualifiedNameAsString();
|
||||
}
|
||||
writer.writeAttribute(XML_FUNCTION, functionFQNString);
|
||||
|
||||
|
||||
EdmEntitySet returnedEntitySet = functionImport.getReturnedEntitySet();
|
||||
if (returnedEntitySet != null) {
|
||||
writer.writeAttribute(XML_ENTITY_SET, containerNamespace + "." + returnedEntitySet.getName());
|
||||
}
|
||||
writer.writeAttribute(XML_INCLUDE_IN_SERVICE_DOCUMENT, "" + functionImport.isIncludeInServiceDocument());
|
||||
|
||||
// TODO: Annotations
|
||||
writer.writeEndElement();
|
||||
}
|
||||
}
|
||||
|
@ -274,7 +276,6 @@ public class MetadataDocumentXmlSerializer {
|
|||
writer.writeStartElement(XML_ACTION_IMPORT);
|
||||
writer.writeAttribute(XML_NAME, actionImport.getName());
|
||||
writer.writeAttribute(XML_ACTION, getAliasedFullQualifiedName(actionImport.getUnboundAction(), false));
|
||||
// TODO: Annotations
|
||||
writer.writeEndElement();
|
||||
}
|
||||
}
|
||||
|
@ -287,7 +288,6 @@ public class MetadataDocumentXmlSerializer {
|
|||
writer.writeAttribute(XML_ENTITY_TYPE, getAliasedFullQualifiedName(singleton.getEntityType(), false));
|
||||
|
||||
appendNavigationPropertyBindings(writer, singleton);
|
||||
// TODO: Annotations
|
||||
writer.writeEndElement();
|
||||
}
|
||||
|
||||
|
@ -312,7 +312,6 @@ public class MetadataDocumentXmlSerializer {
|
|||
writer.writeAttribute(XML_ENTITY_TYPE, getAliasedFullQualifiedName(entitySet.getEntityType(), false));
|
||||
|
||||
appendNavigationPropertyBindings(writer, entitySet);
|
||||
// TODO: Annotations
|
||||
writer.writeEndElement();
|
||||
}
|
||||
}
|
||||
|
@ -322,7 +321,9 @@ public class MetadataDocumentXmlSerializer {
|
|||
for (EdmFunction function : functions) {
|
||||
writer.writeStartElement(XML_FUNCTION);
|
||||
writer.writeAttribute(XML_NAME, function.getName());
|
||||
// TODO: EntitySetPath
|
||||
if (function.getEntitySetPath() != null) {
|
||||
writer.writeAttribute(XML_ENTITY_SET_PATH, function.getEntitySetPath());
|
||||
}
|
||||
writer.writeAttribute(XML_IS_BOUND, "" + function.isBound());
|
||||
writer.writeAttribute(XML_IS_COMPOSABLE, "" + function.isComposable());
|
||||
|
||||
|
@ -373,6 +374,9 @@ public class MetadataDocumentXmlSerializer {
|
|||
for (EdmAction action : actions) {
|
||||
writer.writeStartElement(XML_ACTION);
|
||||
writer.writeAttribute(XML_NAME, action.getName());
|
||||
if (action.getEntitySetPath() != null) {
|
||||
writer.writeAttribute(XML_ENTITY_SET_PATH, action.getEntitySetPath());
|
||||
}
|
||||
writer.writeAttribute(XML_IS_BOUND, "" + action.isBound());
|
||||
|
||||
appendOperationParameters(writer, action);
|
||||
|
@ -424,11 +428,11 @@ public class MetadataDocumentXmlSerializer {
|
|||
if (complexType.getBaseType() != null) {
|
||||
writer.writeAttribute(XML_BASE_TYPE, getAliasedFullQualifiedName(complexType.getBaseType(), false));
|
||||
}
|
||||
|
||||
if(complexType.isAbstract()) {
|
||||
|
||||
if (complexType.isAbstract()) {
|
||||
writer.writeAttribute(ABSTRACT, TRUE);
|
||||
}
|
||||
|
||||
|
||||
appendProperties(writer, complexType);
|
||||
|
||||
appendNavigationProperties(writer, complexType);
|
||||
|
|
|
@ -61,7 +61,6 @@ public class ODataXmlSerializerImpl implements ODataSerializer {
|
|||
CircleStreamBuffer buffer;
|
||||
XMLStreamWriter xmlStreamWriter = null;
|
||||
|
||||
// TODO: move stream initialization into separate method
|
||||
try {
|
||||
buffer = new CircleStreamBuffer();
|
||||
xmlStreamWriter = XMLOutputFactory.newInstance().createXMLStreamWriter(buffer.getOutputStream(), DEFAULT_CHARSET);
|
||||
|
|
Loading…
Reference in New Issue