Search in sources :

Example 26 with DataProcessingException

use of com.linkedin.data.transform.DataProcessingException in project rest.li by linkedin.

the class AnnotatedComplexKeysResource method update.

@RestMethod.PartialUpdate
public Promise<UpdateResponse> update(final ComplexResourceKey<TwoPartKey, TwoPartKey> key, final PatchRequest<Message> patch) {
    final SettablePromise<UpdateResponse> result = Promises.settable();
    final Runnable requestHandler = new Runnable() {

        public void run() {
            try {
                _dataProvider.partialUpdate(key, patch);
                result.done(new UpdateResponse(HttpStatus.S_204_NO_CONTENT));
            } catch (DataProcessingException e) {
                result.done(new UpdateResponse(HttpStatus.S_400_BAD_REQUEST));
            }
        }
    };
    _scheduler.schedule(requestHandler, DELAY, TimeUnit.MILLISECONDS);
    return result;
}
Also used : UpdateResponse(com.linkedin.restli.server.UpdateResponse) DataProcessingException(com.linkedin.data.transform.DataProcessingException)

Aggregations

DataProcessingException (com.linkedin.data.transform.DataProcessingException)26 DataComplexProcessor (com.linkedin.data.transform.DataComplexProcessor)16 Test (org.testng.annotations.Test)13 DataMap (com.linkedin.data.DataMap)10 UpdateResponse (com.linkedin.restli.server.UpdateResponse)10 PatchRequest (com.linkedin.restli.common.PatchRequest)3 Message (com.linkedin.data.message.Message)2 Greeting (com.linkedin.restli.examples.greetings.api.Greeting)2 GroupMembership (com.linkedin.restli.examples.groups.api.GroupMembership)2 BatchPatchRequest (com.linkedin.restli.server.BatchPatchRequest)2 BatchUpdateResult (com.linkedin.restli.server.BatchUpdateResult)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 SimpleDataElement (com.linkedin.data.element.SimpleDataElement)1 ValidationOptions (com.linkedin.data.schema.validation.ValidationOptions)1 ValidationResult (com.linkedin.data.schema.validation.ValidationResult)1 RecordTemplate (com.linkedin.data.template.RecordTemplate)1 MaskComposition (com.linkedin.data.transform.filter.MaskComposition)1 Patch (com.linkedin.data.transform.patch.Patch)1 ComplexResourceKey (com.linkedin.restli.common.ComplexResourceKey)1