]> SALOME platform Git repositories - tools/siman.git/blob - Workspace/Siman/src/org/splat/simer/admin/ProjectElementFacade.java
Salome HOME
e03b78b006a1752fef441aedc651bbd7f417a2dd
[tools/siman.git] / Workspace / Siman / src / org / splat / simer / admin / ProjectElementFacade.java
1 package org.splat.simer.admin;
2
3 import org.splat.dal.bo.som.ProgressState;
4 import org.splat.dal.bo.som.Scenario;
5 import org.splat.dal.bo.som.Study;
6 import org.splat.service.technical.ProjectSettingsService;
7
8
9 public class ProjectElementFacade {
10
11     private transient final long    _index;        // For checking the equality between ProjectElementFacade objects
12     private transient final Study   _my;
13     private transient final String  _subtitle;
14     private transient final String  _step;
15
16 //  ==============================================================================================================================
17 //  Constructor
18 //  ==============================================================================================================================
19
20     public ProjectElementFacade (final Study represented, final ProjectSettingsService.Step at) {
21 //  ------------------------------------------------------------------------
22       _index    = represented.getIndex();         // The index of scenarios AND studies are unique
23       _my       = represented;
24       _subtitle = "";
25       _step     = "0." + at.getNumber();
26     }
27     public ProjectElementFacade (final Scenario represented, final ProjectSettingsService.Step at) {
28 //  ---------------------------------------------------------------------------
29       _index    = represented.getIndex();         // The index of scenarios AND studies are unique
30       _my       = represented.getOwnerStudy();
31       _subtitle = ", " + represented.getTitle();
32       _step     = String.valueOf(_index) + "." + at.getNumber();
33     }
34
35 //  ==============================================================================================================================
36 //  Services for not duplicating Study facades into a Set
37 //  ==============================================================================================================================
38
39     @Override
40         public boolean equals (final Object other) {
41 //  ------------------------------------
42       return (this.hashCode() == other.hashCode());
43     }
44     @Override
45         public int hashCode () {
46 //  ----------------------
47       return  (int) _index;
48     }
49
50 //  ==============================================================================================================================
51 //  Getters
52 //  ==============================================================================================================================
53
54     public String getAuthorName () {
55 //  ------------------------------
56       return  _my.getAuthor().getDisplayName();
57     }
58     public ProgressState getProgressState () {
59 //  ----------------------------------------
60       return  _my.getProgressState();
61     }
62     public String getReference () {
63 //  -----------------------------
64       return  _my.getReference();
65     }
66     public String getSelection () {
67 //  -----------------------------
68       return _step;
69     }
70     public String getStudyIndex () {
71 //  ------------------------------
72       return  String.valueOf(_my.getIndex());
73     }
74     public String getTitle () {
75 //  -------------------------
76       return  _my.getTitle() + _subtitle;
77     }
78 }