Salome HOME
More business logic has been moved from BO to services. ServiceLocator is created...
[tools/siman.git] / Workspace / Siman-Common / src / org / splat / som / StepRights.java
index 6a07bc88cd99b85254c12f209560a96f4130aca8..22f462b11621098d4d4007d52007aa5fd264af9a 100644 (file)
@@ -11,18 +11,14 @@ import org.splat.dal.bo.kernel.User;
 import org.splat.dal.bo.som.ProjectElement;
 import org.splat.dal.bo.som.Scenario;
 import org.splat.dal.bo.som.Study;
+import org.splat.service.ServiceLocatorImpl;
 
 
 public class StepRights {
 
     private User     user;
     private Step     operand;
-
-//  ==============================================================================================================================
-//  Construction
-//  ==============================================================================================================================
-
-    public StepRights (User user, Step step) {
+       public StepRights (User user, Step step) {
 //  ----------------------------------------
       this.user    = user;
       this.operand = step;
@@ -46,7 +42,7 @@ public class StepRights {
     public boolean canAddComment () {
 //  -------------------------------
       Study   owner = operand.getOwnerStudy();
-      return (owner.getAuthor().equals(user) || owner.hasActor(user));
+      return (owner.getAuthor().equals(user) || ServiceLocatorImpl.getInstance().getStudyService().hasActor(owner, user));
     }
 
 /**
@@ -58,7 +54,7 @@ public class StepRights {
     public boolean canCreateDocument () {
 //  -----------------------------------
       if (!isEnabled()) return false;
-      return operand.getOwnerStudy().isStaffedBy(user);
+      return ServiceLocatorImpl.getInstance().getStudyService().isStaffedBy(operand.getOwnerStudy(), user);
     }
 
 /**
@@ -69,7 +65,7 @@ public class StepRights {
  */
     public boolean canCreateKnowledge () {
 //  ------------------------------------
-      return operand.getOwnerStudy().isStaffedBy(user);
+      return ServiceLocatorImpl.getInstance().getStudyService().isStaffedBy(operand.getOwnerStudy(), user);
     }
 
 /**
@@ -81,7 +77,7 @@ public class StepRights {
     public boolean canEditSimulationContext () {
 //  ------------------------------------------
       Study   owner = operand.getOwnerStudy();
-      return (owner.getAuthor().equals(user) || owner.hasActor(user));
+      return (owner.getAuthor().equals(user) || ServiceLocatorImpl.getInstance().getStudyService().hasActor(owner, user));
     }
 
 /**