com.mycompany.expense
Class Rules

java.lang.Object
  extended bycom.mycompany.expense.Rules

public class Rules
extends java.lang.Object

This class contains methods encoding the rules for how a report in the sample expense report application may be handled by the current user.

Version:
1.0
Author:
Hans Bergsten, Gefion Software

Constructor Summary
Rules()
           
 
Method Summary
 boolean canAccept(java.lang.String user, boolean isManager, Report report)
          Returns "true" if the user is a manager and the report is "submitted".
 boolean canDelete(java.lang.String user, boolean isManager, Report report)
          Returns "true" if the user is the report owner and the report isn't locked.
 boolean canEdit(java.lang.String user, boolean isManager, Report report)
          Returns "true" if the user is the report owner and the report isn't locked.
 boolean canReject(java.lang.String user, boolean isManager, Report report)
          Returns "true" if the user is a manager and the report is "submitted".
 boolean canSubmit(java.lang.String user, boolean isManager, Report report)
          Returns "true" if the user is the report owner and the report isn't locked.
 boolean canView(java.lang.String user, boolean isManager, Report report)
          Returns "true" if the user is a manager or the report owner.
 boolean isLocked(Report report)
          Returns "true" if the report is either "submitted" or "accepted".
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Rules

public Rules()
Method Detail

canEdit

public boolean canEdit(java.lang.String user,
                       boolean isManager,
                       Report report)
Returns "true" if the user is the report owner and the report isn't locked.


canDelete

public boolean canDelete(java.lang.String user,
                         boolean isManager,
                         Report report)
Returns "true" if the user is the report owner and the report isn't locked.


canSubmit

public boolean canSubmit(java.lang.String user,
                         boolean isManager,
                         Report report)
Returns "true" if the user is the report owner and the report isn't locked.


canAccept

public boolean canAccept(java.lang.String user,
                         boolean isManager,
                         Report report)
Returns "true" if the user is a manager and the report is "submitted".


canReject

public boolean canReject(java.lang.String user,
                         boolean isManager,
                         Report report)
Returns "true" if the user is a manager and the report is "submitted".


canView

public boolean canView(java.lang.String user,
                       boolean isManager,
                       Report report)
Returns "true" if the user is a manager or the report owner.


isLocked

public boolean isLocked(Report report)
Returns "true" if the report is either "submitted" or "accepted".