@RestMethod.BatchUpdate
public BatchUpdateResult<Long, Greeting> batchUpdate(BatchUpdateRequest<Long, Greeting> entities)
{
final Map<Long, UpdateResponse> responseMap = new HashMap<Long, UpdateResponse>();
responseMap.put(3l, new UpdateResponse(HttpStatus.S_201_CREATED));
final Map<Long, RestLiServiceException> errorsMap = new HashMap<Long, RestLiServiceException>();
errorsMap.put(8l, new RestLiServiceException(HttpStatus.S_202_ACCEPTED));
if (entities.getData().containsKey(1l))
{
//Return a null BatchUpdateResult
return null;
}
else if (entities.getData().containsKey(2l))
{
//Return a BatchUpdateResult with a null results Map
return new BatchUpdateResult<Long, Greeting>(null);
}
else if (entities.getData().containsKey(3l))
{
//Return a BatchUpdateResult with a null errors Map
return new BatchUpdateResult<Long, Greeting>(responseMap, null);
}
else if (entities.getData().containsKey(4l))
{
//Return a BatchUpdateResult with a errors Map that has a null key in it
errorsMap.put(null, new RestLiServiceException(HttpStatus.S_202_ACCEPTED));
return new BatchUpdateResult<Long, Greeting>(responseMap, errorsMap);
}
else if (entities.getData().containsKey(5l))
{
//Return a BatchUpdateResult with a errors Map that has a null value in it
errorsMap.put(9l, null);
return new BatchUpdateResult<Long, Greeting>(responseMap, errorsMap);
}
else
{
//Return a BatchUpdateResult with a map that has a null key in it
responseMap.put(null, new UpdateResponse(HttpStatus.S_201_CREATED));
return new BatchUpdateResult<Long, Greeting>(responseMap);
}
}