commit for FINERACT-70 (Rename deleted standing instruction by appending '_deleted_' string and the id)

This commit is contained in:
Emmanuel Nnaa
2016-08-02 15:46:47 +02:00
parent 56da30c3f9
commit 5647ffb966
2 changed files with 11 additions and 1 deletions
@@ -291,4 +291,12 @@ public class AccountTransferStandingInstruction extends AbstractPersistable<Long
public void updateStatus(Integer status){
this.status = status;
}
/**
* delete the standing instruction by setting the status to 3 and appending "_deleted_" and the id to the name
**/
public void delete() {
this.status = StandingInstructionStatus.DELETED.getValue();
this.name = this.name + "_deleted_" + this.getId();
}
}
@@ -178,7 +178,9 @@ public class StandingInstructionWritePlatformServiceImpl implements StandingInst
@Override
public CommandProcessingResult delete(final Long id) {
AccountTransferStandingInstruction standingInstructionsForUpdate = this.standingInstructionRepository.findOne(id);
standingInstructionsForUpdate.updateStatus(StandingInstructionStatus.DELETED.getValue());
// update the "deleted" and "name" properties of the standing instruction
standingInstructionsForUpdate.delete();
final Map<String, Object> actualChanges = new HashMap<>();
actualChanges.put(statusParamName, StandingInstructionStatus.DELETED.getValue());
return new CommandProcessingResultBuilder() //