Coverage Report - org.openpermis.policy.bean.basic.BasicAuthority
 
Classes in this File Line Coverage Branch Coverage Complexity
BasicAuthority
50%
4/8
N/A
1.5
 
 1  
 /*
 2  
  * Copyright (c) 2009, Swiss Federal Department of Defence Civil Protection and Sport
 3  
  *                     (http://www.vbs.admin.ch)
 4  
  * Copyright (c) 2009, Ergon Informatik AG (http://www.ergon.ch)
 5  
  * All rights reserved.
 6  
  *
 7  
  * Licensed under the Open Permis License which accompanies this distribution,
 8  
  * and is available at http://www.openpermis.org/BSDlicenceKent.txt
 9  
  */
 10  
 package org.openpermis.policy.bean.basic;
 11  
 
 12  
 import java.net.URI;
 13  
 import java.util.Set;
 14  
 
 15  
 import org.openpermis.Subject;
 16  
 import org.openpermis.basic.TimePeriod;
 17  
 import org.openpermis.policy.Role;
 18  
 import org.openpermis.policy.TimeStamp;
 19  
 import org.openpermis.policy.bean.AuthorityBean;
 20  
 import org.openpermis.policy.bean.SerialNumber;
 21  
 
 22  
 
 23  
 /**
 24  
  * Basic implementation of an authority bean.
 25  
  * @since 0.1.0
 26  
  */
 27  
 public class BasicAuthority
 28  
         extends BasicPartBean
 29  
         implements AuthorityBean
 30  
 {
 31  
 
 32  
         //---- Static
 33  
 
 34  
         /**
 35  
          * @since 0.1.0
 36  
          */
 37  
         private static final long serialVersionUID = 299722778399378194L;
 38  
 
 39  
         //---- Constructors
 40  
 
 41  
         /**
 42  
          * Creates an authority with the specified URI.
 43  
          * @param serialNumber the serial number of this part.
 44  
          * @param identity the {@link URI} that identifies this authority.
 45  
          * @since 0.1.0
 46  
          */
 47  
         protected BasicAuthority (SerialNumber serialNumber, URI identity) {
 48  262
                 super(AuthorityBean.class, serialNumber);
 49  262
                 setIdentity(identity);
 50  262
         }
 51  
 
 52  
         //---- Subject
 53  
 
 54  
         /**
 55  
          * @since 0.1.0
 56  
          */
 57  
         public Set<Role> getAssignedRoles (TimeStamp timeStamp, Set<Role> roles) {
 58  0
                 throw new IllegalStateException("Authority cannot be used as subject in access decisions");
 59  
         }
 60  
 
 61  
         /**
 62  
          * @since 0.1.0
 63  
          */
 64  
         public Set<Subject> getIssuersOf (Role roleRef) {
 65  0
                 throw new IllegalStateException("Authority cannot be asked for issuers.");
 66  
         }
 67  
         
 68  
         /**
 69  
          * @since 0.3.0
 70  
          */
 71  
         public TimePeriod getValidityOf (Role role, Subject issuer) {
 72  0
                 throw new IllegalStateException("Authority cannot be asked for validity.");
 73  
         }
 74  
 
 75  
         //---- AbstractDomainEntity
 76  
 
 77  
         /**
 78  
          * @since 0.1.0
 79  
          */
 80  
         @Override
 81  
         protected boolean comparablePart (BasicPart entity) {
 82  62
                 return entity instanceof AuthorityBean;
 83  
         }
 84  
 
 85  
         /**
 86  
          * @since 0.1.0
 87  
          */
 88  
         @Override
 89  
         protected String getSimpleClassName () {
 90  0
                 return AuthorityBean.class.getSimpleName();
 91  
         }
 92  
 
 93  
 }