01: package org.osbl.riskmanagement.process;
02:
03: import org.osbl.riskmanagement.model.Risk;
04: import org.osbl.riskmanagement.model.Record;
05: import org.osbl.identity.model.Identity;
06: import org.concern.library.generic.FormClassNameActivity;
07: import org.concern.controller.ActivityExecutionException;
08:
09: import java.math.BigDecimal;
10: import java.sql.Timestamp;
11: import java.util.List;
12: import java.util.ArrayList;
13:
14: public class Adjust extends FormClassNameActivity<Risk> {
15: @Override
16: public void delist(Risk risk) throws ActivityExecutionException {
17: /*PROTECTED REGION ID(org.osbl.riskmanagement.process.Adjust.delist) ENABLED START*/
18: BigDecimal coverage = risk.getCoverage();
19: BigDecimal amount = risk.getAmount();
20: BigDecimal probability = risk.getProbability();
21: String comment = risk.getComment();
22:
23: List<Record> progression = risk.getProgression();
24: if (progression == null)
25: risk.setProgression(progression = new ArrayList<Record>(1));
26:
27: Record record = progression.size() > 0 ? progression
28: .get(progression.size() - 1) : null;
29: if (record == null
30: || !coverage.equals(record.getCoverage())
31: || !amount.equals(record.getAmount())
32: || !probability.equals(record.getProbability())
33: || comment == null
34: && record.getComment() != null
35: || (comment != null && !comment.equals(record
36: .getComment()))) {
37: record = new Record();
38: record.setTimestamp(new Timestamp(System
39: .currentTimeMillis()));
40: record.setCoverage(coverage);
41: record.setAmount(amount);
42: record.setProbability(probability);
43: record.setComment(risk.getComment());
44: progression.add(record);
45: System.out.println("add record: " + record);
46: }
47: /*PROTECTED REGION END*/
48: }
49: }
|