* Class defining the default rights related to operations on study steps.
*
* @author Daniel Brunier-Coulin
- * @copyright OPEN CASCADE 2012
+ * @copyright OPEN CASCADE 2012-2015
*/
//TODO: Review this rights according to the state of the owner study.
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;
}
// ==============================================================================================================================
*/
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));
}
/**
*/
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);
}
/**
*/
public boolean canCreateKnowledge () {
// ------------------------------------
- return ServiceLocatorImpl.getInstance().getStudyService().isStaffedBy(operand.getOwnerStudy(), user);
+ return ServiceLocatorImpl.getInstance().getStudyService().isStaffedBy(_operand.getOwnerStudy(), _user);
}
/**
*/
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));
}
/**
*/
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;
}
public Step getOperand () {
// -------------------------
- return operand;
+ return _operand;
}
}
\ No newline at end of file