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.library.generic.FormClassNameCreateEvent;
08: import org.concern.controller.ActivityExecutionException;
09:
10: import java.math.BigDecimal;
11: import java.sql.Timestamp;
12: import java.util.List;
13: import java.util.ArrayList;
14:
15: public class WasCreated extends FormClassNameCreateEvent<Risk> {
16: @Override
17: public void occured(Risk risk) throws ActivityExecutionException {
18: /*PROTECTED REGION ID(org.osbl.riskmanagement.process.WasCreated.occured) ENABLED START*/
19: Identity assignee = risk.getAssignee();
20: BigDecimal coverage = risk.getCoverage();
21: BigDecimal amount = risk.getAmount();
22: BigDecimal probability = risk.getProbability();
23:
24: if (assignee != null && coverage != null && amount != null
25: && probability != null) {
26: Record record = new Record();
27: record.setTimestamp(new Timestamp(System
28: .currentTimeMillis()));
29: record.setCoverage(coverage);
30: record.setAmount(amount);
31: record.setProbability(probability);
32: record.setComment(risk.getComment());
33: List<Record> progression = new ArrayList<Record>();
34: progression.add(record);
35: risk.setProgression(progression);
36: System.out.println("first record: " + record);
37: }
38: /*PROTECTED REGION END*/
39: }
40: }
|