@Override public IBatchElement updateBatchElement(String operationToken, long index, IBatchElementUpdateRequest request) throws SiteWhereException { MongoCollection<Document> elements = getMongoClient().getBatchOperationElementsCollection(getTenant()); Document dbElement = assertBatchElement(operationToken, index); BatchElement element = MongoBatchElement.fromDocument(dbElement); SiteWherePersistence.batchElementUpdateLogic(request, element); Document updated = MongoBatchElement.toDocument(element); Document query = new Document(MongoBatchElement.PROP_BATCH_OPERATION_TOKEN, operationToken) .append(MongoBatchElement.PROP_INDEX, index); MongoPersistence.update(elements, query, updated); return MongoBatchElement.fromDocument(updated); }
byte[] elementKey = getElementRowKey(context, operationToken, index); SiteWherePersistence.batchElementUpdateLogic(request, element); byte[] payload = context.getPayloadMarshaler().encodeBatchElement(element);