Class BwPrincipal<T extends BwPrincipal<?>>

All Implemented Interfaces:
Serializable, Comparable<BwPrincipal<?>>, Comparator<BwPrincipal<?>>, org.bedework.access.AccessPrincipal, org.bedework.util.logging.Logged
Direct Known Subclasses:
BwGroup, BwLocpr, BwShareablePrincipal, BwUser

public abstract class BwPrincipal<T extends BwPrincipal<?>> extends BwDbentity<BwPrincipal<?>> implements org.bedework.access.AccessPrincipal, Comparator<BwPrincipal<?>>
Value object to represent a calendar principal. Principals may be users, groups or other special obects. Principals may own objects within the system or simply identify a client to the system.

We need to address a problem that might occur with groups. If we choose to allow a group all the facilities of a single user (subscriptions, ownership etc) then we need to be careful with names and their uniqueness.

That is to say, the name will probably not be unique, for example, I might have the id douglm and be a member of the group douglm.

Allowing groups all the rights of a user gives us the current functionality of administrative groups as well as the functions we need for departmental sites.

Version:
1.0
Author:
Mike Douglass douglm rpi.edu
See Also:
  • Field Details

  • Constructor Details

    • BwPrincipal

      public BwPrincipal()
      Create a guest BwPrincipal
  • Method Details

    • makePrincipal

      public static BwPrincipal<?> makePrincipal(int whoType)
      Parameters:
      whoType - - type of principal
      Returns:
      a principal based on type - null if unknown.
    • makeUserPrincipal

      public static BwPrincipal<?> makeUserPrincipal()
      Returns:
      a user principal
    • makeGroupPrincipal

      public static BwPrincipal<?> makeGroupPrincipal()
      Returns:
      a group principal
    • makeLocationPrincipal

      public static BwPrincipal<?> makeLocationPrincipal()
      Returns:
      a location/venue principal
    • isPrincipal

      public static boolean isPrincipal(String href)
    • makePrincipal

      public static BwPrincipal<?> makePrincipal(String href)
    • makePrincipalHref

      public static String makePrincipalHref(String id, int whoType) throws org.bedework.access.AccessException
      Throws:
      org.bedework.access.AccessException
    • getKind

      public abstract int getKind()
      Specified by:
      getKind in interface org.bedework.access.AccessPrincipal
    • setKind

      public void setKind(int ignoredVal)
    • setUnauthenticated

      public void setUnauthenticated(boolean val)
      Specified by:
      setUnauthenticated in interface org.bedework.access.AccessPrincipal
    • getUnauthenticated

      public boolean getUnauthenticated()
      Specified by:
      getUnauthenticated in interface org.bedework.access.AccessPrincipal
    • setAccount

      public void setAccount(String val)
      Specified by:
      setAccount in interface org.bedework.access.AccessPrincipal
    • getAccount

      public String getAccount()
      Specified by:
      getAccount in interface org.bedework.access.AccessPrincipal
    • getAclAccount

      public String getAclAccount()
      Specified by:
      getAclAccount in interface org.bedework.access.AccessPrincipal
    • setPrincipalRef

      public void setPrincipalRef(String val)
      Specified by:
      setPrincipalRef in interface org.bedework.access.AccessPrincipal
    • setDescription

      public void setDescription(String val)
      Specified by:
      setDescription in interface org.bedework.access.AccessPrincipal
    • getDescription

      public String getDescription()
      Specified by:
      getDescription in interface org.bedework.access.AccessPrincipal
    • getPrincipalRef

      public String getPrincipalRef()
      Specified by:
      getPrincipalRef in interface org.bedework.access.AccessPrincipal
    • setCreated

      public void setCreated(Timestamp val)
      Parameters:
      val - timestamp
    • getCreated

      public Timestamp getCreated()
      Returns:
      Timestamp created
    • setLogon

      public void setLogon(Timestamp val)
      Parameters:
      val - timestamp
    • getLogon

      public Timestamp getLogon()
      Returns:
      Timetstamp last logon
    • setLastAccess

      public void setLastAccess(Timestamp val)
      Parameters:
      val - timestamp
    • getLastAccess

      public Timestamp getLastAccess()
      Returns:
      Timestamp last access
    • setLastModify

      public void setLastModify(Timestamp val)
      Parameters:
      val - timestamp
    • getLastModify

      public Timestamp getLastModify()
      Returns:
      Timestamp last mod
    • setQuota

      public void setQuota(long val)
      Quota for this user. This will have to be an estimate I imagine.
      Parameters:
      val - quota
    • getQuota

      public long getQuota()
      Returns:
      long
    • setCategoryAccess

      public void setCategoryAccess(String val)
      Parameters:
      val - The categoryAccess to set.
    • getCategoryAccess

      public String getCategoryAccess()
      Returns:
      Returns the categoryAccess.
    • setLocationAccess

      public void setLocationAccess(String val)
      Parameters:
      val - The locationAccess to set.
    • getLocationAccess

      public String getLocationAccess()
      Returns:
      Returns the locationAccess.
    • setContactAccess

      public void setContactAccess(String val)
      Parameters:
      val - The contactAccess to set.
    • getContactAccess

      public String getContactAccess()
      Returns:
      Returns the contactAccess.
    • getAccountNoSlash

      public String getAccountNoSlash()
      Returns:
      String account name without any leading "/"
    • getAccountSplit

      public String[] getAccountSplit()
      Returns:
      String[] account name split on "/"
    • setGroups

      public void setGroups(Collection<BwGroup<?>> val)
      Set of groups of which principal is a member. These are not just those of which the principal is a direct member but also those it is a member of by virtue of membership of other groups. For example
      If the principal is a member of groupA and groupA is a member of groupB the groupB should appear in the list.
      Parameters:
      val - Collection of BwPrincipal
    • getGroups

      public Collection<BwGroup<?>> getGroups()
      Get the groups of which principal is a member.
      Returns:
      Collection of BwGroup
    • setPrincipalInfo

      public void setPrincipalInfo(BwPrincipalInfo val)
      Parameters:
      val - info
    • getPrincipalInfo

      public BwPrincipalInfo getPrincipalInfo()
      Returns:
      BwPrincipalInfo principal info
    • setHref

      public void setHref(String val)
      Set the href
      Overrides:
      setHref in class BwUnversionedDbentity<BwPrincipal<?>>
      Parameters:
      val - String href
    • getHref

      public String getHref()
      Overrides:
      getHref in class BwUnversionedDbentity<BwPrincipal<?>>
      Returns:
      non null unique href for the entity
    • addGroup

      public void addGroup(BwGroup<?> val)
      Parameters:
      val - BwPrincipal
    • setGroupNames

      public void setGroupNames(Collection<String> val)
      Specified by:
      setGroupNames in interface org.bedework.access.AccessPrincipal
    • getGroupNames

      public Collection<String> getGroupNames()
      Specified by:
      getGroupNames in interface org.bedework.access.AccessPrincipal
    • toStringSegment

      protected void toStringSegment(org.bedework.util.misc.ToString ts)
      Description copied from class: BwUnversionedDbentity
      Add our stuff to the ToString object
      Overrides:
      toStringSegment in class BwUnversionedDbentity<BwPrincipal<?>>
      Parameters:
      ts - ToString for result
    • toStringSegment

      public static void toStringSegment(org.bedework.util.misc.ToString ts, String name, BwPrincipal<?> val)
      Add a principal to the ToString object
      Parameters:
      ts - ToString object
      name - tag
      val - BwPrincipal
    • copyTo

      public void copyTo(BwPrincipal<?> val)
      Copy this to val
      Parameters:
      val - BwPrincipal target
    • getRestoreCallback

      public static org.bedework.util.xml.FromXmlCallback getRestoreCallback()
    • compareTo

      public int compareTo(BwPrincipal that)
      Specified by:
      compareTo in interface Comparable<T extends BwPrincipal<?>>
      Overrides:
      compareTo in class BwUnversionedDbentity<BwPrincipal<?>>
    • compare

      public int compare(BwPrincipal p1, BwPrincipal p2)
      Specified by:
      compare in interface Comparator<T extends BwPrincipal<?>>
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class BwUnversionedDbentity<BwPrincipal<?>>
    • equals

      public boolean equals(Object o)
      Specified by:
      equals in interface Comparator<T extends BwPrincipal<?>>
      Overrides:
      equals in class BwUnversionedDbentity<BwPrincipal<?>>
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • clone

      public abstract Object clone()
      Description copied from class: BwUnversionedDbentity
      Make visible
      Overrides:
      clone in class BwUnversionedDbentity<BwPrincipal<?>>
      Returns:
      Object of class T