[OLINGO-564] Minor clean up
This commit is contained in:
parent
7a4b562724
commit
59766b23b9
|
@ -80,7 +80,7 @@ public interface UriHelper {
|
||||||
* @param entityLink the link as String
|
* @param entityLink the link as String
|
||||||
* @param rawServiceRoot the root URI of the service
|
* @param rawServiceRoot the root URI of the service
|
||||||
* @return a list of key predicates
|
* @return a list of key predicates
|
||||||
* @throws DeserializationException in case the link is malformed
|
* @throws DeserializerException in case the link is malformed
|
||||||
*/
|
*/
|
||||||
List<UriParameter> getKeyPredicatesFromEntityLink(Edm edm, String entityLink, String rawServiceRoot)
|
List<UriParameter> getKeyPredicatesFromEntityLink(Edm edm, String entityLink, String rawServiceRoot)
|
||||||
throws DeserializerException;
|
throws DeserializerException;
|
||||||
|
|
|
@ -168,7 +168,7 @@ public class DataCreator {
|
||||||
createPrimitive("PropertyInt32", Integer.MAX_VALUE),
|
createPrimitive("PropertyInt32", Integer.MAX_VALUE),
|
||||||
createPrimitive("PropertyInt64", Long.MAX_VALUE),
|
createPrimitive("PropertyInt64", Long.MAX_VALUE),
|
||||||
createPrimitive("PropertySByte", Byte.MAX_VALUE),
|
createPrimitive("PropertySByte", Byte.MAX_VALUE),
|
||||||
createPrimitive("PropertyTimeOfDay", getTime(21, 05, 59))
|
createPrimitive("PropertyTimeOfDay", getTime(21, 5, 59))
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
.addProperty(new PropertyImpl(null, "PropertyCompNav", ValueType.LINKED_COMPLEX, createCTPrimCompValue(1)))
|
.addProperty(new PropertyImpl(null, "PropertyCompNav", ValueType.LINKED_COMPLEX, createCTPrimCompValue(1)))
|
||||||
|
@ -201,7 +201,7 @@ public class DataCreator {
|
||||||
cvAllPrim.getValue().add(createPrimitive("PropertyInt32", Integer.MAX_VALUE));
|
cvAllPrim.getValue().add(createPrimitive("PropertyInt32", Integer.MAX_VALUE));
|
||||||
cvAllPrim.getValue().add(createPrimitive("PropertyInt64", Long.MAX_VALUE));
|
cvAllPrim.getValue().add(createPrimitive("PropertyInt64", Long.MAX_VALUE));
|
||||||
cvAllPrim.getValue().add(createPrimitive("PropertySByte", Byte.MAX_VALUE));
|
cvAllPrim.getValue().add(createPrimitive("PropertySByte", Byte.MAX_VALUE));
|
||||||
cvAllPrim.getValue().add(createPrimitive("PropertyTimeOfDay", getTime(21, 05, 59)));
|
cvAllPrim.getValue().add(createPrimitive("PropertyTimeOfDay", getTime(21, 5, 59)));
|
||||||
|
|
||||||
return cvAllPrim;
|
return cvAllPrim;
|
||||||
}
|
}
|
||||||
|
@ -640,7 +640,7 @@ public class DataCreator {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void linkESTwoKeyNav(Map<String, EntitySet> data2) {
|
private void linkESTwoKeyNav(Map<String, EntitySet> data) {
|
||||||
final EntitySet entitySet = data.get("ESTwoKeyNav");
|
final EntitySet entitySet = data.get("ESTwoKeyNav");
|
||||||
final List<Entity> esKeyNavTargets = data.get("ESKeyNav").getEntities();
|
final List<Entity> esKeyNavTargets = data.get("ESKeyNav").getEntities();
|
||||||
final List<Entity> esTwoKeyNavTargets = data.get("ESTwoKeyNav").getEntities();
|
final List<Entity> esTwoKeyNavTargets = data.get("ESTwoKeyNav").getEntities();
|
||||||
|
|
|
@ -272,11 +272,10 @@ public class DataProvider {
|
||||||
// Deep insert (only if not an update)
|
// Deep insert (only if not an update)
|
||||||
if (isInsert) {
|
if (isInsert) {
|
||||||
handleDeepInsert(rawBaseUri, edmEntitySet, entity, changedEntity);
|
handleDeepInsert(rawBaseUri, edmEntitySet, entity, changedEntity);
|
||||||
} else if (isInsert && changedEntity.getNavigationLinks().size() != 0) {
|
|
||||||
throw new DataProviderException("Deep inserts are not allowed in update operations using PUT or PATCH requests.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!changedEntity.getNavigationBindings().isEmpty()) {
|
final boolean navigationBindingsAvailable = !changedEntity.getNavigationBindings().isEmpty();
|
||||||
|
if (navigationBindingsAvailable) {
|
||||||
applyNavigationBinding(rawBaseUri, edmEntitySet, entity, changedEntity.getNavigationBindings());
|
applyNavigationBinding(rawBaseUri, edmEntitySet, entity, changedEntity.getNavigationBindings());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -320,7 +319,7 @@ public class DataProvider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleDeepInsert(final String rawBaseUri, final EdmEntitySet edmEntitySet, Entity entity,
|
private void handleDeepInsert(final String rawBaseUri, final EdmEntitySet edmEntitySet, final Entity entity,
|
||||||
final Entity changedEntity)
|
final Entity changedEntity)
|
||||||
throws DataProviderException {
|
throws DataProviderException {
|
||||||
final EdmEntityType entityType = edmEntitySet.getEntityType();
|
final EdmEntityType entityType = edmEntitySet.getEntityType();
|
||||||
|
@ -352,10 +351,10 @@ public class DataProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Entity> createInlineEntities(final String rawBaseUri, final EdmBindingTarget target,
|
private List<Entity> createInlineEntities(final String rawBaseUri, final EdmBindingTarget target,
|
||||||
final EdmEntityType type, final EntitySet changedEntitsSet) throws DataProviderException {
|
final EdmEntityType type, final EntitySet changedEntitySet) throws DataProviderException {
|
||||||
List<Entity> entities = new ArrayList<Entity>();
|
List<Entity> entities = new ArrayList<Entity>();
|
||||||
|
|
||||||
for (final Entity newEntity : changedEntitsSet.getEntities()) {
|
for (final Entity newEntity : changedEntitySet.getEntities()) {
|
||||||
entities.add(createInlineEntity(rawBaseUri, target, type, newEntity));
|
entities.add(createInlineEntity(rawBaseUri, target, type, newEntity));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,11 +45,11 @@ public class TechnicalBatchProcessor extends TechnicalProcessor implements Batch
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void processBatch(BatchFacade fascade, ODataRequest request, ODataResponse response)
|
public void processBatch(BatchFacade facade, ODataRequest request, ODataResponse response)
|
||||||
throws BatchSerializerException, BatchDeserializerException {
|
throws BatchSerializerException, BatchDeserializerException {
|
||||||
boolean continueOnError = isContinueOnError(request);
|
boolean continueOnError = isContinueOnError(request);
|
||||||
|
|
||||||
final String boundary = fascade.extractBoundaryFromContentType(request.getHeader(HttpHeader.CONTENT_TYPE));
|
final String boundary = facade.extractBoundaryFromContentType(request.getHeader(HttpHeader.CONTENT_TYPE));
|
||||||
final BatchOptions options = BatchOptions.with()
|
final BatchOptions options = BatchOptions.with()
|
||||||
.rawBaseUri(request.getRawBaseUri())
|
.rawBaseUri(request.getRawBaseUri())
|
||||||
.rawServiceResolutionUri(request.getRawServiceResolutionUri()).build();
|
.rawServiceResolutionUri(request.getRawServiceResolutionUri()).build();
|
||||||
|
@ -58,7 +58,7 @@ public class TechnicalBatchProcessor extends TechnicalProcessor implements Batch
|
||||||
final List<ODataResponsePart> responseParts = new ArrayList<ODataResponsePart>();
|
final List<ODataResponsePart> responseParts = new ArrayList<ODataResponsePart>();
|
||||||
|
|
||||||
for (BatchRequestPart part : parts) {
|
for (BatchRequestPart part : parts) {
|
||||||
final ODataResponsePart responsePart = fascade.handleBatchRequest(part);
|
final ODataResponsePart responsePart = facade.handleBatchRequest(part);
|
||||||
responseParts.add(responsePart); // Also add failed responses
|
responseParts.add(responsePart); // Also add failed responses
|
||||||
final int statusCode = responsePart.getResponses().get(0).getStatusCode();
|
final int statusCode = responsePart.getResponses().get(0).getStatusCode();
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ public class TechnicalBatchProcessor extends TechnicalProcessor implements Batch
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final String responseBoundary = "batch_" + UUID.randomUUID().toString();;
|
final String responseBoundary = "batch_" + UUID.randomUUID().toString();
|
||||||
final InputStream responseContent =
|
final InputStream responseContent =
|
||||||
odata.createFixedFormatSerializer().batchResponse(responseParts, responseBoundary);
|
odata.createFixedFormatSerializer().batchResponse(responseParts, responseBoundary);
|
||||||
response.setHeader(HttpHeader.CONTENT_TYPE, ContentType.MULTIPART_MIXED + ";boundary=" + responseBoundary);
|
response.setHeader(HttpHeader.CONTENT_TYPE, ContentType.MULTIPART_MIXED + ";boundary=" + responseBoundary);
|
||||||
|
@ -93,12 +93,12 @@ public class TechnicalBatchProcessor extends TechnicalProcessor implements Batch
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ODataResponsePart processChangeSet(BatchFacade fascade, List<ODataRequest> requests)
|
public ODataResponsePart processChangeSet(BatchFacade facade, List<ODataRequest> requests)
|
||||||
throws BatchDeserializerException {
|
throws BatchDeserializerException {
|
||||||
List<ODataResponse> responses = new ArrayList<ODataResponse>();
|
List<ODataResponse> responses = new ArrayList<ODataResponse>();
|
||||||
|
|
||||||
for (ODataRequest request : requests) {
|
for (ODataRequest request : requests) {
|
||||||
final ODataResponse oDataResponse = fascade.handleODataRequest(request);
|
final ODataResponse oDataResponse = facade.handleODataRequest(request);
|
||||||
final int statusCode = oDataResponse.getStatusCode();
|
final int statusCode = oDataResponse.getStatusCode();
|
||||||
|
|
||||||
if (statusCode < 400) {
|
if (statusCode < 400) {
|
||||||
|
|
Loading…
Reference in New Issue