    View Javadoc
    1   /*
    2    * Copyright (c) 2003
    3    * Information Desire GmbH
    4    * All rights reserved.
    5    */
    6   package com.infodesire.infobit.dao;
    7
    8   import java.util.HashSet;
    9   import java.util.Set;
    10  import java.util.Collection;
    11  import java.util.Collections;
    12  import java.util.Map;
    13  import java.util.HashMap;
    14
    15  import com.infodesire.infobit.data.Acl;
    16  import com.infodesire.infobit.data.Capability;
    17
    18  import org.apache.commons.logging.Log;
    19  import org.apache.commons.logging.LogFactory;
    20
    21  /***
    22   * ACL is access control list for various infobits. Treat is as "security
    23   * domain". several infobits will share same security domain. ACL lists several
    24   * "capabilities and binds them to certain user "roles".
    25   *
    26   * @author            konstantin
    27   * @created           August 6, 2003
    28   * @version           $Revision: 1.7 $
    29   * @hibernate.class   table="acl"
    30   * @hibernate.query   name="aclByName" query="from acl in class
    31   *      com.infodesire.infobit.dao.AclImpl where acl.name = :name"
    32   * @hibernate.query   name="listAclByName" query="from acl in class
    33   *      com.infodesire.infobit.dao.AclImpl order by acl.name"
    34   */
    35  final class AclImpl extends BaseEntityImpl implements Acl {
    36
    37      /***
    38       */
    39      private static Log _log = LogFactory.getLog(AclImpl.class);
    40
    41      /***
    42       */
    43      private String  _name;
    44
    45      /***
    46       */
    47      private String  _description;
    48
    49      /***
    50       */
    51      private Collection _infobits;
    52
    53      /***
    54       */
    55      private Map     _securityLinkMap = new HashMap();
    56
    57
    58      /***
    59       * name of given ACL. name shall not change after creation.
    60       *
    61       * @return               The Name value
    62       * @hibernate.property   unique="true" not-null="true" insert="true"
    63       *      update="false"
    64       */
    65      public String getName() {
    66          return _name;
    67      }
    68
    69
    70
    71      /***
    72       * @return                             The SecurityLinkMap value
    73       * @hibernate.map                      cascade="all"
    74       * @hibernate.collection-key           column="aclid"
    75       * @hibernate.collection-one-to-many
    76       *      class="com.infodesire.infobit.dao.SecurityLink"
    77       * @hibernate.collection-index         column="capabilityid"
    78       *      type="com.infodesire.infobit.dao.CapabilityImpl"
    79       */
    80      public Map getSecurityLinkMap() {
    81          return _securityLinkMap;
    82      }
    83
    84
    85      /***
    86       * Gets the Roles attribute of the AclImpl object
    87       *
    88       * @param capability  Description of Parameter
    89       * @return            The Roles value
    90       */
    91      public Set getRoles(Capability capability) {
    92          SecurityLink sl = (SecurityLink) getSecurityLinkMap().get(capability);
    93          if (sl == null) {
    94              return Collections.EMPTY_SET;
    95          }
    96          else {
    97              return sl.getRoles();
    98          }
    99      }
    100
    101
    102
    103     /***
    104      * provide unmodifable infobit list.
    105      *
    106      * @return                             The Infobits value
    107      * @hibernate.collection-key           column="aclid"
    108      * @hibernate.collection-one-to-many
    109      *      class="com.infodesire.infobit.dao.InfobitImpl"
    110      * @hibernate.set                      cascade="none" lazy="true"
    111      *      order-by="name"
    112      */
    113     public Collection getInfobits() {
    114         return _infobits;
    115     }
    116
    117
    118     /***
    119      * acl description for humans
    120      *
    121      * @return               description for humans
    122      * @hibernate.property
    123      */
    124     public String getDescription() {
    125         return _description;
    126     }
    127
    128
    129     /***
    130      * @param securityLinkMap  The new SecurityLinkMap value
    131      */
    132     public void setSecurityLinkMap(Map securityLinkMap) {
    133         _securityLinkMap = securityLinkMap;
    134     }
    135
    136
    137
    138     /***
    139      * Sets the Infobits attribute of the Acl object
    140      *
    141      * @param infobits  The new Infobits value
    142      */
    143     public void setInfobits(Collection infobits) {
    144         _infobits = infobits;
    145     }
    146
    147
    148     /***
    149      * Sets the Name attribute of the Acl object
    150      *
    151      * @param name  The new Name value
    152      */
    153     public void setName(String name) {
    154         _name = name;
    155     }
    156
    157
    158     /***
    159      * Sets the Description attribute of the Acl object
    160      *
    161      * @param description  The new Description value
    162      */
    163     public void setDescription(String description) {
    164         _description = description;
    165     }
    166
    167 }

This page was automatically generated by Maven