public List<Processing> fromMessage(Message message) { List<Processing> processings = new ArrayList<>(); switch (message.getType()) { case DocumentProtocol.MESSAGE_PUTDOCUMENT: { PutDocumentMessage putMessage = (PutDocumentMessage) message; DocumentPut putOperation = new DocumentPut(createPutDocument(putMessage)); putOperation.setCondition(putMessage.getCondition()); processings.add(createProcessing(putOperation, message)); break; } case DocumentProtocol.MESSAGE_UPDATEDOCUMENT: { UpdateDocumentMessage updateMessage = (UpdateDocumentMessage) message; DocumentUpdate updateOperation = updateMessage.getDocumentUpdate(); updateOperation.setCondition(updateMessage.getCondition()); processings.add(createProcessing(updateOperation, message)); break; } case DocumentProtocol.MESSAGE_REMOVEDOCUMENT: { RemoveDocumentMessage removeMessage = (RemoveDocumentMessage) message; DocumentRemove removeOperation = new DocumentRemove(removeMessage.getDocumentId()); removeOperation.setCondition(removeMessage.getCondition()); processings.add(createProcessing(removeOperation, message)); break; } } return processings; }