1 package org.splat.dal.bo.som;
4 * @author Daniel Brunier-Coulin
5 * @copyright OPEN CASCADE 2012
8 import java.io.Serializable;
10 import org.splat.dal.bo.kernel.Persistent;
11 import org.splat.kernel.InvalidPropertyException;
12 import org.splat.service.technical.ProjectSettingsService;
15 public class SimulationContextType extends Persistent implements Serializable {
19 private ProgressState state;
22 // Required by the serialization
23 private static final long serialVersionUID = 4819425038576161242L;
25 // ==============================================================================================================================
27 // ==============================================================================================================================
29 // Search properties class
30 public static class Properties {
31 // ------------------------------
32 private ProgressState state = null;
33 private ProjectSettingsService.Step step = null;
35 public ProgressState getProgressState () {
38 public ProjectSettingsService.Step getStep () {
41 public Properties setProgressState (ProgressState state) {
45 public Properties setStep (ProjectSettingsService.Step step) {
50 // Database fetch constructor
51 protected SimulationContextType () {
53 // Initialization constructor
54 public SimulationContextType (String name, ProjectSettingsService.Step step) throws InvalidPropertyException {
55 // ------------------------------------------------------------------------
58 this.state = ProgressState.inCHECK;
59 this.step = step.getNumber();
62 // ==============================================================================================================================
63 // Public member functions
64 // ==============================================================================================================================
66 public boolean equals(Object entity) {
67 // ------------------------------------
68 if (entity == null) return false;
69 if (entity instanceof String) {
70 return this.name.equals((String)entity); // Names are unique
72 if (entity instanceof SimulationContextType) {
73 SimulationContextType object = (SimulationContextType)entity;
74 long he = object.getIndex();
75 long me = this.getIndex();
76 if (me*he != 0) return (he == me);
77 else return this.getName().equals(object.getName());
83 public String getName () {
84 // ------------------------
88 public boolean isAttachedTo (ProjectSettingsService.Step step) {
89 // -------------------------------------------------------
90 if (this.step == step.getNumber()) return true;
94 public boolean isApproved () {
95 // ----------------------------
96 return (state == ProgressState.APPROVED);
102 public ProgressState getState() {
107 * @param state the state to set
109 public void setState(ProgressState state) {
116 public int getStep() {
121 * @param step the step to set
123 public void setStep(int step) {