[OLINGO-1391]OData V4: Move the olingo library to java 8

This commit is contained in:
ramya vasanth 2019-09-04 09:17:51 +05:30
parent 7632ec7268
commit 9f8cbc6fcc
6 changed files with 57 additions and 29 deletions

View File

@ -601,8 +601,13 @@ public class ODataDispatcher {
validateIsSingleton(method);
validatePreconditions(request, false);
validatePreferHeader(request);
handler.selectProcessor(isMedia ? MediaEntityProcessor.class : EntityProcessor.class)
.deleteEntity(request, response, uriInfo);
if (isMedia) {
((MediaEntityProcessor) handler.selectProcessor(MediaEntityProcessor.class))
.deleteEntity(request, response, uriInfo);
} else {
((EntityProcessor) handler.selectProcessor(EntityProcessor.class))
.deleteEntity(request, response, uriInfo);
}
} else {
throwMethodNotAllowed(method);
}

View File

@ -100,12 +100,19 @@ public class FixedFormatDeserializerImpl implements FixedFormatDeserializer {
result.setType(type.getFullQualifiedName().getFullQualifiedNameAsString());
final EdmPrimitiveType primitiveType = (EdmPrimitiveType) type;
try {
result.setValue(type.getKind() == EdmTypeKind.ENUM ? ValueType.ENUM : ValueType.PRIMITIVE,
primitiveType.valueOfString(primitiveType.fromUriLiteral(content),
parameter.isNullable(), parameter.getMaxLength(), parameter.getPrecision(), parameter.getScale(), true,
parameter.getMapping() == null ?
primitiveType.getDefaultType() :
parameter.getMapping().getMappedJavaClass()));
if (parameter.getMapping() == null) {
result.setValue(type.getKind() == EdmTypeKind.ENUM ? ValueType.ENUM : ValueType.PRIMITIVE,
primitiveType.valueOfString(primitiveType.fromUriLiteral(content),
parameter.isNullable(), parameter.getMaxLength(),
parameter.getPrecision(), parameter.getScale(), true,
primitiveType.getDefaultType()));
} else {
result.setValue(type.getKind() == EdmTypeKind.ENUM ? ValueType.ENUM : ValueType.PRIMITIVE,
primitiveType.valueOfString(primitiveType.fromUriLiteral(content),
parameter.isNullable(), parameter.getMaxLength(),
parameter.getPrecision(), parameter.getScale(), true,
parameter.getMapping().getMappedJavaClass()));
}
} catch (final EdmPrimitiveTypeException e) {
throw new DeserializerException(
"Invalid value '" + content + "' for parameter " + parameter.getName(), e,

View File

@ -619,12 +619,15 @@ public class ParserHelper {
parseAliasValue(parameter.getAlias(),
edmParameter.getType(), edmParameter.isNullable(), edmParameter.isCollection(),
edm, type, aliases).getText() : null;
primitiveType.valueOfString(primitiveType.fromUriLiteral(text),
edmParameter.isNullable(), edmParameter.getMaxLength(), edmParameter.getPrecision(),
edmParameter.getScale(), true,
edmParameter.getMapping() == null ?
primitiveType.getDefaultType() :
edmParameter.getMapping().getMappedJavaClass());
if (edmParameter.getMapping() == null) {
primitiveType.valueOfString(primitiveType.fromUriLiteral(text),
edmParameter.isNullable(), edmParameter.getMaxLength(), edmParameter.getPrecision(),
edmParameter.getScale(), true, primitiveType.getDefaultType());
} else {
primitiveType.valueOfString(primitiveType.fromUriLiteral(text),
edmParameter.isNullable(), edmParameter.getMaxLength(), edmParameter.getPrecision(),
edmParameter.getScale(), true, edmParameter.getMapping().getMappedJavaClass());
}
} catch (final EdmPrimitiveTypeException e) {
throw new UriValidationException(
"Invalid value '" + text + "' for parameter " + parameter.getName(), e,

View File

@ -143,11 +143,17 @@ public class DataProvider {
throw new DataProviderException("Expression in key value is not supported yet!",
HttpStatusCode.NOT_IMPLEMENTED);
}
Object keyValue = null;
final String text = key.getAlias() == null ? key.getText() : ((Literal) key.getExpression()).getText();
final Object keyValue = type.valueOfString(type.fromUriLiteral(text),
property.isNullable(), property.getMaxLength(), property.getPrecision(), property.getScale(),
property.isUnicode(),
Calendar.class.isAssignableFrom(value.getClass()) ? Calendar.class : value.getClass());
if (Calendar.class.isAssignableFrom(value.getClass())) {
keyValue = type.valueOfString(type.fromUriLiteral(text),
property.isNullable(), property.getMaxLength(), property.getPrecision(), property.getScale(),
property.isUnicode(), Calendar.class);
} else {
keyValue = type.valueOfString(type.fromUriLiteral(text),
property.isNullable(), property.getMaxLength(), property.getPrecision(), property.getScale(),
property.isUnicode(), value.getClass());
}
if (!value.equals(keyValue)) {
found = false;
break;
@ -958,10 +964,16 @@ public class DataProvider {
HttpStatusCode.NOT_IMPLEMENTED);
}
final String text = key.getAlias() == null ? key.getText() : ((Literal) key.getExpression()).getText();
final Object keyValue = type.valueOfString(type.fromUriLiteral(text),
property.isNullable(), property.getMaxLength(), property.getPrecision(), property.getScale(),
property.isUnicode(),
Calendar.class.isAssignableFrom(value.getClass()) ? Calendar.class : value.getClass());
Object keyValue = null;
if (Calendar.class.isAssignableFrom(value.getClass())) {
keyValue = type.valueOfString(type.fromUriLiteral(text),
property.isNullable(), property.getMaxLength(), property.getPrecision(), property.getScale(),
property.isUnicode(), Calendar.class);
} else {
keyValue = type.valueOfString(type.fromUriLiteral(text),
property.isNullable(), property.getMaxLength(), property.getPrecision(), property.getScale(),
property.isUnicode(), value.getClass());
}
if (!value.equals(keyValue)) {
found = false;
break;

12
pom.xml
View File

@ -104,7 +104,7 @@
<!-- Project build settings -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.source>1.6</project.build.source>
<project.build.source>1.8</project.build.source>
<olingo.deploy.skip>true</olingo.deploy.skip>
<!-- Setting needed for Java 8 release builds -->
@ -330,12 +330,12 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.12.1</version>
<version>3.1.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<version>3.8.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@ -514,13 +514,15 @@
</goals>
</execution>
</executions>
<configuration>
<configuration combine.self="override">
<outputFileFormat>xml</outputFileFormat>
<consoleOutput>true</consoleOutput>
<enableRSS>false</enableRSS>
<linkXRef>false</linkXRef>
<configLocation>src/checkstyle/config.xml</configLocation>
<sourceDirectory>${basedir}/src</sourceDirectory>
<sourceDirectories>
<sourceDirectory>${basedir}/src</sourceDirectory>
</sourceDirectories>
<encoding>${project.build.sourceEncoding}</encoding>
<failOnViolation>true</failOnViolation>
<violationSeverity>warning</violationSeverity>

View File

@ -29,7 +29,6 @@
<module name="Checker">
<property name="severity" value="warning"/>
<module name="TreeWalker">
<module name="FileContentsHolder"/>
<module name="IllegalImport">
<property name="severity" value="info"/>
<property name="illegalPkgs" value="java.awt, javax.swing"/>
@ -69,6 +68,6 @@
<module name="LineLength">
<property name="max" value="120"/>
</module>
<module name="SuppressionCommentFilter"/>
</module>
<module name="SuppressionCommentFilter"/>
</module>