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