1 package org.splat.service.dto;
3 import java.util.Iterator;
6 import org.splat.dal.bo.som.ProgressState;
7 import org.splat.dal.bo.som.SimulationContext;
8 import org.splat.dal.bo.som.SimulationContextType;
9 import org.splat.service.technical.ProjectSettingsService;
11 public class SimulationContextFacade {
13 private transient final SimulationContext _my;
14 private transient final String _name;
15 private transient int _at;
16 private transient ProgressState _state;
18 // ==============================================================================================================================
20 // ==============================================================================================================================
22 public SimulationContextFacade(final SimulationContext represented,
23 final List<ProjectSettingsService.Step> steps) {
24 // --------------------------------------------------------------
25 SimulationContextType mytype;
28 mytype = _my.getType();
29 for (Iterator<ProjectSettingsService.Step> i = steps.iterator(); i
31 ProjectSettingsService.Step step = i.next();
32 if (!mytype.isAttachedTo(step)) {
35 _at = step.getNumber(); // There is no direct service for getting the step number
38 _name = _my.getType().getName();
39 if (mytype.isApproved()) {
40 _state = ProgressState.inCHECK;
41 // RKV: TODO: Do translation in presentation layer by struts tools: name = ResourceBundle.getBundle("som",
42 // ApplicationSettings.getCurrentLocale()).getString("type.context." + name);
44 _state = ProgressState.inDRAFT;
48 // ==============================================================================================================================
50 // ==============================================================================================================================
52 public String getEditIcon() {
53 // ----------------------------
54 StringBuffer result = new StringBuffer("icon.ed").append(_state).append(
56 return result.toString();
59 public String getIndex() {
60 // -------------------------
61 return String.valueOf(_my.getIndex());
64 public int getStepNumber() {
65 // ---------------------------
69 public String getTypeName() {
70 // ----------------------------
74 public String getValue() {
75 // -------------------------
76 return _my.getValue();