Coverage Report - org.kuali.rice.ksb.security.admin.KeyStoreEntryDataContainer
 
Classes in this File Line Coverage Branch Coverage Complexity
KeyStoreEntryDataContainer
0%
0/22
0%
0/2
1.222
 
 1  
 /*
 2  
  * Copyright 2007-2008 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  * http://www.opensource.org/licenses/ecl2.php
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 package org.kuali.rice.ksb.security.admin;
 17  
 
 18  
 import java.io.Serializable;
 19  
 import java.security.KeyStore;
 20  
 import java.util.Date;
 21  
 import java.util.HashMap;
 22  
 import java.util.Map;
 23  
 
 24  
 /**
 25  
  * Class used to hold displayable data for KeyStore entries 
 26  
  * 
 27  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 28  
  *
 29  
  */
 30  
 public class KeyStoreEntryDataContainer implements Serializable {
 31  
     
 32  
     private static final String DISPLAYABLE_ENTRY_TYPE_TRUSTED_CERTIFICATE = "Trusted Certificate";
 33  
     private static final String DISPLAYABLE_ENTRY_TYPE_PRIVATE_KEY = "Private Key";
 34  
     private static final String DISPLAYABLE_ENTRY_TYPE_SECRET_KEY = "Secret Key";
 35  
     
 36  0
     public static final Map<Class<? extends KeyStore.Entry>,String> DISPLAYABLE_ENTRY_TYPES = new HashMap<Class<? extends KeyStore.Entry>,String>();
 37  
     static {
 38  0
         DISPLAYABLE_ENTRY_TYPES.put(KeyStore.TrustedCertificateEntry.class, DISPLAYABLE_ENTRY_TYPE_TRUSTED_CERTIFICATE);
 39  0
         DISPLAYABLE_ENTRY_TYPES.put(KeyStore.PrivateKeyEntry.class, DISPLAYABLE_ENTRY_TYPE_PRIVATE_KEY);
 40  0
         DISPLAYABLE_ENTRY_TYPES.put(KeyStore.SecretKeyEntry.class, DISPLAYABLE_ENTRY_TYPE_SECRET_KEY);
 41  0
     }
 42  
 
 43  
     private String alias;
 44  
     private Date createDate;
 45  
     private Class<? extends KeyStore.Entry> type;
 46  
     
 47  
     public KeyStoreEntryDataContainer(String alias, Date createDate) {
 48  0
         super();
 49  0
         this.alias = alias;
 50  0
         this.createDate = createDate;
 51  0
     }
 52  
     
 53  
     public boolean isAllowsRemoval() {
 54  0
         if (KeyStore.TrustedCertificateEntry.class.equals(type)) {
 55  0
             return true;
 56  
         }
 57  0
         return false;
 58  
     }
 59  
     
 60  
     public String getDisplayType() {
 61  0
         return DISPLAYABLE_ENTRY_TYPES.get(getType());
 62  
     }
 63  
 
 64  
     /**
 65  
      * @return the alias
 66  
      */
 67  
     public String getAlias() {
 68  0
         return this.alias;
 69  
     }
 70  
 
 71  
     /**
 72  
      * @param alias the alias to set
 73  
      */
 74  
     public void setAlias(String alias) {
 75  0
         this.alias = alias;
 76  0
     }
 77  
 
 78  
     /**
 79  
      * @return the createDate
 80  
      */
 81  
     public Date getCreateDate() {
 82  0
         return this.createDate;
 83  
     }
 84  
 
 85  
     /**
 86  
      * @param createDate the createDate to set
 87  
      */
 88  
     public void setCreateDate(Date createDate) {
 89  0
         this.createDate = createDate;
 90  0
     }
 91  
 
 92  
     /**
 93  
      * @return the type
 94  
      */
 95  
     public Class<? extends KeyStore.Entry> getType() {
 96  0
         return this.type;
 97  
     }
 98  
 
 99  
     /**
 100  
      * @param type the type to set
 101  
      */
 102  
     public void setType(Class<? extends KeyStore.Entry> type) {
 103  0
         this.type = type;
 104  0
     }
 105  
     
 106  
 }