jdonmvc_cqrs_es 例子的不明白之处

15-10-27 m3310
    

jdonmvc_cqrs_es 例子中有不明白之处,如下:

1、

@OnCommand("UserSaveCommand")

public void update(UpdateCommand updateCommand) {

if (!updateCommand.getNewUserDTO().getUserId().equals(this.userId)) {

System.err.print("update not this user");

return;

}

this.username = updateCommand.getNewUserDTO().getUsername();

this.email = updateCommand.getNewUserDTO().getEmail();

this.es.updated(new UserUpdatedEvent(updateCommand.getNewUserDTO()));

this.setUploadFile(updateCommand.getUploadVO());

}

2、

public void setUploadFile(UploadVO event) {

es.saveUpload(event);

UploadFile uploadFile = new UploadFile();

uploadFile.setData(event.getFilesData());

uploadFile.setContentType(event.getContextType());

uploadFile.setName(event.getFilename());

getAttachment().setUploadFile(uploadFile);

}

3、

@Send("saveUpload")

public DomainMessage saveUpload(UploadVO event) {

return new DomainMessage(event);

}

4、

@OnEvent("saveUpload")

public void save(UploadFile uploadFile) {

uploadRepository.deleteUploadFile(uploadFile.getParentId());

uploadRepository.createUploadFile(uploadFile);

}

为什么到了这里,变成了UploadFile uploadFile?

    

banq
2015-10-29 09:13

2015-10-27 15:11 "@m3310"的内容
为什么到了这里,变成了UploadFile uploadFile? ...

可能是Bug,传入的应该不变性的值对象,也就是事件对象。