private Record updateMutableFields(Record record, boolean latestRecordType, List<MutationCondition> conditions,
FieldTypes fieldTypes) throws RepositoryException {
Record newRecord = record.cloneRecord();
RecordId recordId = record.getId();
Long version = record.getVersion();
if (version == null) {
throw new InvalidRecordException("The version of the record cannot be null to update mutable fields",
record.getId());
}
try {
Map<QName, Object> fields = getFieldsToUpdate(record);
fields = filterMutableFields(fields, fieldTypes);
Pair<Record, byte[]> recordAndOcc = readWithOcc(recordId, version, null, fieldTypes);
Record originalRecord = new UnmodifiableRecord(recordAndOcc.getV1());
byte[] oldOccBytes = recordAndOcc.getV2();
Map<QName, Object> originalFields = filterMutableFields(originalRecord.getFields(), fieldTypes);
Record originalNextRecord = null;
Map<QName, Object> originalNextFields = null;
try {
originalNextRecord = read(recordId, version + 1, null, fieldTypes);
originalNextFields = filterMutableFields(originalNextRecord.getFields(), fieldTypes);
} catch (VersionNotFoundException e) {
// There is no next version of the record
}
Put put = new Put(recordId.toBytes());
Set<BlobReference> referencedBlobs = new HashSet<BlobReference>();
Set<BlobReference> unReferencedBlobs = new HashSet<BlobReference>();
RecordEvent recordEvent = new RecordEvent();
recordEvent.setType(Type.UPDATE);