Salome HOME
0bde2f768aab02d880e5c3f6cc1cb9b5f2244e3d
[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       _index    = represented.getIndex();         // The index of scenarios AND studies are unique
22       _my       = represented;
23       _subtitle = "";
24       _step     = "0." + at.getNumber();
25     }
26     public ProjectElementFacade (final Scenario represented, final ProjectSettingsService.Step at) {
27       _index    = represented.getIndex();         // The index of scenarios AND studies are unique
28       _my       = represented.getOwnerStudy();
29       _subtitle = ", " + represented.getTitle();
30       _step     = String.valueOf(_index) + "." + at.getNumber();
31     }
32
33 //  ==============================================================================================================================
34 //  Services for not duplicating Study facades into a Set
35 //  ==============================================================================================================================
36
37     @Override
38         public boolean equals (final Object other) {
39       return (this.hashCode() == other.hashCode());
40     }
41     @Override
42         public int hashCode () {
43       return  (int) _index;
44     }
45
46 //  ==============================================================================================================================
47 //  Getters
48 //  ==============================================================================================================================
49
50     public String getAuthorName () {
51       return  _my.getAuthor().getDisplayName();
52     }
53     public ProgressState getProgressState () {
54       return  _my.getProgressState();
55     }
56     public String getReference () {
57       return  _my.getReference();
58     }
59     public String getSelection () {
60       return _step;
61     }
62     public String getStudyIndex () {
63       return  String.valueOf(_my.getIndex());
64     }
65     public String getTitle () {
66       return  _my.getTitle() + _subtitle;
67     }
68 }