Coverage Report - pt.digitalis.dif.utils.cache.CacheScope
 
Classes in this File Line Coverage Branch Coverage Complexity
CacheScope
0%
0/18
N/A
1
 
 1  0
 /**
 2  
  * 2009, Digitalis Informatica. All rights reserved. Distribuicao e Gestao de Informatica, Lda. Estrada de Paco de Arcos
 3  
  * num.9 - Piso -1 2780-666 Paco de Arcos Telefone: (351) 21 4408990 Fax: (351) 21 4408999 http://www.digitalis.pt
 4  
  */
 5  
 
 6  
 package pt.digitalis.dif.utils.cache;
 7  
 
 8  
 /**
 9  
  * @author Pedro Viegas <a href="mailto:pviegas@digitalis.pt">pviegas@digitalis.pt</a><br/>
 10  
  * @created 16 de Mar de 2011
 11  
  */
 12  0
 public enum CacheScope {
 13  
 
 14  
     /** For all requests, if no other level exists */
 15  0
     GLOBAL,
 16  
 
 17  
     /** Group scope. for every session of a user of this group. Will take precedence over GLOBAL scope **/
 18  0
     GROUP,
 19  
 
 20  
     /** Session scope. Ends with session and is saved within it. Will take precedence above all others */
 21  0
     SESSION,
 22  
 
 23  
     /** User scope. for every session of the same user. Will take precedence over GROUP and GLOBAL scopes */
 24  0
     USER;
 25  
 
 26  
     /**
 27  
      * @param groupID
 28  
      * @return a GROUP instance with the specific group defined
 29  
      */
 30  
     public static CacheScope GROUPInstance(String groupID)
 31  
     {
 32  0
         CacheScope instance = GROUP;
 33  0
         instance.setScopeID(groupID);
 34  
 
 35  0
         return instance;
 36  
     }
 37  
 
 38  
     /**
 39  
      * @param sessionID
 40  
      * @return a SESION instance with the specific session defined
 41  
      */
 42  
     public static CacheScope SESSIONInstance(String sessionID)
 43  
     {
 44  0
         CacheScope instance = SESSION;
 45  0
         instance.setScopeID(sessionID);
 46  
 
 47  0
         return instance;
 48  
     }
 49  
 
 50  
     /**
 51  
      * @param userID
 52  
      * @return a USER instance with the specific user defined
 53  
      */
 54  
     public static CacheScope USERInstance(String userID)
 55  
     {
 56  0
         CacheScope instance = USER;
 57  0
         instance.setScopeID(userID);
 58  
 
 59  0
         return instance;
 60  
     }
 61  
 
 62  
     /**  */
 63  
     private String scopeID;
 64  
 
 65  
     /**
 66  
      * Inspector for the 'scopeID' attribute.
 67  
      * 
 68  
      * @return the scopeID value
 69  
      */
 70  
     protected String getScopeID()
 71  
     {
 72  0
         return scopeID;
 73  
     }
 74  
 
 75  
     /**
 76  
      * Modifier for the 'scopeID' attribute.
 77  
      * 
 78  
      * @param scopeID
 79  
      *            the new scopeID value to set
 80  
      */
 81  
     protected void setScopeID(String scopeID)
 82  
     {
 83  0
         this.scopeID = scopeID;
 84  0
     }
 85  
 }