Coverage Report - org.openpermis.editor.policy.adapter.overview.DomainBeanOverview
 
Classes in this File Line Coverage Branch Coverage Complexity
DomainBeanOverview
88%
8/9
75%
3/4
3
 
 1  
 /*
 2  
  * Copyright (c) 2009, Ergon Informatik AG (http://www.ergon.ch)
 3  
  * All rights reserved.
 4  
  * 
 5  
  * Licensed under the Open Permis License which accompanies this distribution, 
 6  
  * and is available at http://www.openpermis.org/BSDlicenceKent.txt
 7  
  */
 8  
 package org.openpermis.editor.policy.adapter.overview;
 9  
 
 10  
 import org.openpermis.policy.bean.DomainBean;
 11  
 
 12  
 
 13  
 /**
 14  
  * Describes a {@link DomainBean} that has been adapted to a short overview string.
 15  
  * @since 0.3.0
 16  
  */
 17  1
 public class DomainBeanOverview implements Overview {                                                                                                
 18  
 
 19  
 
 20  
         //---- Static
 21  
         
 22  
         //---- State
 23  
         
 24  
         private DomainBean domain;                                                                                                                                                
 25  
         
 26  
         //---- Constructors
 27  
         
 28  
         /**
 29  
          * Creates a domain bean overview adaptee.
 30  
          * @param domain the {@link DomainBean}.
 31  
          * @since 0.3.0
 32  
          */
 33  2
         public DomainBeanOverview (DomainBean domain) {
 34  2
                 if (domain == null) {
 35  1
                         throw new IllegalArgumentException("Domain is null.");
 36  
                 }
 37  1
                 this.domain = domain;
 38  1
         }
 39  
         
 40  
         //---- Methods
 41  
         
 42  
         //---- Overview
 43  
         
 44  
         /**
 45  
          * @since 0.3.0
 46  
          */
 47  
         public String get () {
 48  1
                 if (this.domain.getIdentity() == null) {
 49  0
                         return "";
 50  
                 }
 51  1
                 return this.domain.getIdentity().toString();
 52  
         }
 53  
 
 54  
 
 55  
 }