Package org.bedework.calfacade
Class BwPrincipal<T extends BwPrincipal<?>>
java.lang.Object
- 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:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bedework.calfacade.base.DumpEntity
DumpEntity.DumpType -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringprotected StringDefault access to category entriesprotected StringDefault access to contact entriesprotected Timestampprotected Collection<String>static final Stringprotected Collection<BwGroup<?>>static final Stringprotected TimestampLast time principal did something in our system.protected TimestampLast time principal modified something in our system.protected StringDefault access to location entriesprotected TimestampLast time we saw this principal appear in our system.protected BwPrincipalInfostatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringprotected booleanstatic final Stringstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidabstract Objectclone()Make visibleintcompare(BwPrincipal p1, BwPrincipal p2) intcompareTo(BwPrincipal that) voidcopyTo(BwPrincipal<?> val) Copy this to valbooleanString[]Collection<BwGroup<?>>Get the groups of which principal is a member.getHref()abstract intgetKind()getLogon()longgetQuota()static org.bedework.util.xml.FromXmlCallbackbooleaninthashCode()static booleanisPrincipal(String href) static BwPrincipal<?>static BwPrincipal<?>static BwPrincipal<?>makePrincipal(int whoType) static BwPrincipal<?>makePrincipal(String href) static StringmakePrincipalHref(String id, int whoType) static BwPrincipal<?>voidsetAccount(String val) voidsetCategoryAccess(String val) voidsetContactAccess(String val) voidsetCreated(Timestamp val) voidsetDescription(String val) voidsetGroupNames(Collection<String> val) voidsetGroups(Collection<BwGroup<?>> val) Set of groups of which principal is a member.voidSet the hrefvoidsetKind(int ignoredVal) voidsetLastAccess(Timestamp val) voidsetLastModify(Timestamp val) voidsetLocationAccess(String val) voidvoidvoidsetPrincipalRef(String val) voidsetQuota(long val) Quota for this user.voidsetUnauthenticated(boolean val) toString()protected voidtoStringSegment(org.bedework.util.misc.ToString ts) Add our stuff to the ToString objectstatic voidtoStringSegment(org.bedework.util.misc.ToString ts, String name, BwPrincipal<?> val) Add a principal to the ToString objectMethods inherited from class org.bedework.calfacade.base.BwDbentity
addDeletedEntity, afterDeletion, beforeDeletion, beforeSave, beforeUpdate, getByteSize, getDeletedEntities, getSeq, length, setByteSize, setSeqMethods inherited from class org.bedework.calfacade.base.BwUnversionedDbentity
getId, markUnsaved, setId, unsavedMethods inherited from class org.bedework.calfacade.base.DumpEntity
dump, dump, getLogger, hasDumpValueMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLongMethods inherited from interface org.bedework.util.logging.Logged
audit, debug, debug, debug, enableAuditLogger, enableErrorLogger, enableMetricsLogger, error, error, error, getLogLevel, info, isAuditLoggerEnabled, isErrorLoggerEnabled, isMetricsDebugEnabled, isMetricsLoggerEnabled, metrics, setLoggerClass, setLoggerClass, trace, trace, trace, warn
-
Field Details
-
principalRoot
- See Also:
-
groupPrincipalRoot
- See Also:
-
hostPrincipalRoot
- See Also:
-
resourcePrincipalRoot
- See Also:
-
ticketPrincipalRoot
- See Also:
-
userPrincipalRoot
- See Also:
-
venuePrincipalRoot
- See Also:
-
bwadmingroupPrincipalRoot
- See Also:
-
publicUser
- See Also:
-
publicUserHref
-
calsuitePrincipalRoot
- See Also:
-
created
-
logon
Last time we saw this principal appear in our system. -
lastAccess
Last time principal did something in our system. -
lastModify
Last time principal modified something in our system. -
categoryAccess
Default access to category entries -
contactAccess
Default access to contact entries -
locationAccess
Default access to location entries -
unauthenticated
protected boolean unauthenticated -
principalInfo
-
groups
-
groupNames
-
-
Constructor Details
-
BwPrincipal
public BwPrincipal()Create a guest BwPrincipal
-
-
Method Details
-
makePrincipal
- Parameters:
whoType- - type of principal- Returns:
- a principal based on type - null if unknown.
-
makeUserPrincipal
- Returns:
- a user principal
-
makeGroupPrincipal
- Returns:
- a group principal
-
makeLocationPrincipal
- Returns:
- a location/venue principal
-
isPrincipal
-
makePrincipal
-
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:
getKindin interfaceorg.bedework.access.AccessPrincipal
-
setKind
public void setKind(int ignoredVal) -
setUnauthenticated
public void setUnauthenticated(boolean val) - Specified by:
setUnauthenticatedin interfaceorg.bedework.access.AccessPrincipal
-
getUnauthenticated
public boolean getUnauthenticated()- Specified by:
getUnauthenticatedin interfaceorg.bedework.access.AccessPrincipal
-
setAccount
- Specified by:
setAccountin interfaceorg.bedework.access.AccessPrincipal
-
getAccount
- Specified by:
getAccountin interfaceorg.bedework.access.AccessPrincipal
-
getAclAccount
- Specified by:
getAclAccountin interfaceorg.bedework.access.AccessPrincipal
-
setPrincipalRef
- Specified by:
setPrincipalRefin interfaceorg.bedework.access.AccessPrincipal
-
setDescription
- Specified by:
setDescriptionin interfaceorg.bedework.access.AccessPrincipal
-
getDescription
- Specified by:
getDescriptionin interfaceorg.bedework.access.AccessPrincipal
-
getPrincipalRef
- Specified by:
getPrincipalRefin interfaceorg.bedework.access.AccessPrincipal
-
setCreated
- Parameters:
val- timestamp
-
getCreated
- Returns:
- Timestamp created
-
setLogon
- Parameters:
val- timestamp
-
getLogon
- Returns:
- Timetstamp last logon
-
setLastAccess
- Parameters:
val- timestamp
-
getLastAccess
- Returns:
- Timestamp last access
-
setLastModify
- Parameters:
val- 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
- Parameters:
val- The categoryAccess to set.
-
getCategoryAccess
- Returns:
- Returns the categoryAccess.
-
setLocationAccess
- Parameters:
val- The locationAccess to set.
-
getLocationAccess
- Returns:
- Returns the locationAccess.
-
setContactAccess
- Parameters:
val- The contactAccess to set.
-
getContactAccess
- Returns:
- Returns the contactAccess.
-
getAccountNoSlash
- Returns:
- String account name without any leading "/"
-
getAccountSplit
- Returns:
- String[] account name split on "/"
-
setGroups
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
Get the groups of which principal is a member.- Returns:
- Collection of BwGroup
-
setPrincipalInfo
- Parameters:
val- info
-
getPrincipalInfo
- Returns:
- BwPrincipalInfo principal info
-
setHref
Set the href- Overrides:
setHrefin classBwUnversionedDbentity<BwPrincipal<?>>- Parameters:
val- String href
-
getHref
- Overrides:
getHrefin classBwUnversionedDbentity<BwPrincipal<?>>- Returns:
- non null unique href for the entity
-
addGroup
- Parameters:
val- BwPrincipal
-
setGroupNames
- Specified by:
setGroupNamesin interfaceorg.bedework.access.AccessPrincipal
-
getGroupNames
- Specified by:
getGroupNamesin interfaceorg.bedework.access.AccessPrincipal
-
toStringSegment
protected void toStringSegment(org.bedework.util.misc.ToString ts) Description copied from class:BwUnversionedDbentityAdd our stuff to the ToString object- Overrides:
toStringSegmentin classBwUnversionedDbentity<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 objectname- tagval- BwPrincipal
-
copyTo
Copy this to val- Parameters:
val- BwPrincipal target
-
getRestoreCallback
public static org.bedework.util.xml.FromXmlCallback getRestoreCallback() -
compareTo
- Specified by:
compareToin interfaceComparable<T extends BwPrincipal<?>>- Overrides:
compareToin classBwUnversionedDbentity<BwPrincipal<?>>
-
compare
- Specified by:
comparein interfaceComparator<T extends BwPrincipal<?>>
-
hashCode
public int hashCode()- Overrides:
hashCodein classBwUnversionedDbentity<BwPrincipal<?>>
-
equals
- Specified by:
equalsin interfaceComparator<T extends BwPrincipal<?>>- Overrides:
equalsin classBwUnversionedDbentity<BwPrincipal<?>>
-
toString
-
clone
Description copied from class:BwUnversionedDbentityMake visible- Overrides:
clonein classBwUnversionedDbentity<BwPrincipal<?>>- Returns:
- Object of class T
-