Salome HOME
Modifications done to respect PMD rules. Versioning a document is fixed. Validation...
[tools/siman.git] / Workspace / Siman-Common / src / org / splat / som / StepRights.java
index 22f462b11621098d4d4007d52007aa5fd264af9a..b91efd1eadc3eb45f33654afc5ede8bb1e98d473 100644 (file)
@@ -16,17 +16,17 @@ import org.splat.service.ServiceLocatorImpl;
 
 public class StepRights {
 
-    private User     user;
-    private Step     operand;
-       public StepRights (User user, Step step) {
+    private final transient User     _user;
+    private final transient Step     _operand;
+       public StepRights (final User user, final Step step) {
 //  ----------------------------------------
-      this.user    = user;
-      this.operand = step;
+      this._user    = user;
+      this._operand = step;
     }
-    public StepRights (Step step) {
+    public StepRights (final Step step) {
 //  -----------------------------
-      this.user    = step.getOwner().getAuthor();
-      this.operand = step;
+      this._user    = step.getOwner().getAuthor();
+      this._operand = step;
     }
 
 //  ==============================================================================================================================
@@ -41,8 +41,8 @@ public class StepRights {
  */
     public boolean canAddComment () {
 //  -------------------------------
-      Study   owner = operand.getOwnerStudy();
-      return (owner.getAuthor().equals(user) || ServiceLocatorImpl.getInstance().getStudyService().hasActor(owner, user));
+      Study   owner = _operand.getOwnerStudy();
+      return (owner.getAuthor().equals(_user) || ServiceLocatorImpl.getInstance().getStudyService().hasActor(owner, _user));
     }
 
 /**
@@ -53,8 +53,10 @@ public class StepRights {
  */
     public boolean canCreateDocument () {
 //  -----------------------------------
-      if (!isEnabled()) return false;
-      return ServiceLocatorImpl.getInstance().getStudyService().isStaffedBy(operand.getOwnerStudy(), user);
+      if (!isEnabled()) {
+               return false;
+       }
+      return ServiceLocatorImpl.getInstance().getStudyService().isStaffedBy(_operand.getOwnerStudy(), _user);
     }
 
 /**
@@ -65,7 +67,7 @@ public class StepRights {
  */
     public boolean canCreateKnowledge () {
 //  ------------------------------------
-      return ServiceLocatorImpl.getInstance().getStudyService().isStaffedBy(operand.getOwnerStudy(), user);
+      return ServiceLocatorImpl.getInstance().getStudyService().isStaffedBy(_operand.getOwnerStudy(), _user);
     }
 
 /**
@@ -76,8 +78,8 @@ public class StepRights {
  */
     public boolean canEditSimulationContext () {
 //  ------------------------------------------
-      Study   owner = operand.getOwnerStudy();
-      return (owner.getAuthor().equals(user) || ServiceLocatorImpl.getInstance().getStudyService().hasActor(owner, user));
+      Study   owner = _operand.getOwnerStudy();
+      return (owner.getAuthor().equals(_user) || ServiceLocatorImpl.getInstance().getStudyService().hasActor(owner, _user));
     }
 
 /**
@@ -88,11 +90,13 @@ public class StepRights {
  */
     public boolean isEnabled () {
 //  ---------------------------
-      ProjectElement  owner = operand.getOwner();
+      ProjectElement  owner = _operand.getOwner();
       
       if (owner instanceof Scenario) {
         Scenario  scene = (Scenario)owner;
-        if (scene.isCheckedout()) return false;
+        if (scene.isCheckedout()) {
+                       return false;
+               }
       }
       return true;
     }
@@ -103,6 +107,6 @@ public class StepRights {
 
     public Step getOperand () {
 //  -------------------------
-      return operand;
+      return _operand;
     }
 }
\ No newline at end of file