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 (final ProgressState state) {
45 public Properties setStep (final ProjectSettingsService.Step step) {
50 // Database fetch constructor
51 protected SimulationContextType () {
53 // Initialization constructor
54 public SimulationContextType (final String name, final ProjectSettingsService.Step step) throws InvalidPropertyException {
55 // ------------------------------------------------------------------------
58 this.state = ProgressState.inCHECK;
59 this.step = step.getNumber();
62 // ==============================================================================================================================
63 // Public member functions
64 // ==============================================================================================================================
67 public boolean equals(final Object entity) {
68 // ------------------------------------
72 if (entity instanceof String) {
73 return this.name.equals(entity); // Names are unique
74 } else if (entity instanceof SimulationContextType) {
75 SimulationContextType object = (SimulationContextType)entity;
76 long he = object.getIndex();
77 long me = this.getIndex();
81 return this.getName().equals(object.getName());
88 public String getName () {
89 // ------------------------
93 public boolean isAttachedTo (final ProjectSettingsService.Step step) {
94 // -------------------------------------------------------
95 if (this.step == step.getNumber()) {
101 public boolean isApproved () {
102 // ----------------------------
103 return (state == ProgressState.APPROVED);
109 public ProgressState getState() {
114 * @param state the state to set
116 public void setState(final ProgressState state) {
123 public int getStep() {
128 * @param step the step to set
130 public void setStep(final int step) {