uPortal 2.4.1
API Documentation

org.jasig.portal.channels.groupsmanager
Class GroupsManagerXML

java.lang.Object
  extended byorg.jasig.portal.channels.groupsmanager.GroupsManagerXML
All Implemented Interfaces:
GroupsManagerConstants

public class GroupsManagerXML
extends java.lang.Object
implements GroupsManagerConstants

Contains a groups of static methods used to centralize the generation and retrieval of xml elements for groups and entities.

Version:
$Revision: 1.29 $
Author:
Don Fracapane

Field Summary
 
Fields inherited from interface org.jasig.portal.channels.groupsmanager.GroupsManagerConstants
ADD_REMOVE_PERMISSION, ASSIGN_PERMISSION, BASE_PACKAGE, BROWSE_MODE, COMMANDS_PACKAGE, CREATE_PERMISSION, DELETE_PERMISSION, EDIT_MODE, ENTITY_CLASSNAME, ENTITY_TAGNAME, GROUP_CLASSNAME, GROUP_TAGNAME, GROUPS_PACKAGE, MEMBERS_ONLY_MODE, OWNER, PROPERTIES_TAGNAME, ROOT_GROUP_DESCRIPTION, ROOT_GROUP_TITLE, SECURITY_PACKAGE, SELECT_MODE, SELECT_PERMISSION, UPDATE_PERMISSION, VIEW_PERMISSION, WRAPPERS_PACKAGE
 
Constructor Summary
GroupsManagerXML()
           
 
Method Summary
static void clearPropertiesCache(IGroupMember gm)
          Removes all EntityProperites for a GroupMember from the Entity Property cache.
static org.w3c.dom.Element createElement(java.lang.String name, org.w3c.dom.Document xmlDoc, boolean setGrpDefault)
          Creates an element for the provided Document.
static void createPermissions(CGroupsManagerSessionData sessionData, IEntityGroup childEntGrp)
          Creates permissions to a group for the current user and generates permission elements
static org.w3c.dom.Element createRdfElement(IEntityGroup entGrp, org.w3c.dom.Document xmlDoc)
          Returns an RDF element for the provided Document
static void expandGroupElementXML(org.w3c.dom.Element expandedElem, CGroupsManagerUnrestrictedSessionData sd)
          Expands an element
static org.w3c.dom.Element getAuthorizationXml(ChannelStaticData sd, org.w3c.dom.Element apRoot, org.w3c.dom.Document xmlDoc)
          Returns an element holding the user's permissions used to determine access privileges in the Groups Manager channel.
static org.w3c.dom.Element getElementById(org.w3c.dom.Document aDoc, java.lang.String id)
          Returns an element from an xml document for a unique id.
static org.w3c.dom.Element getElementByTagNameAndId(org.w3c.dom.Document aDoc, java.lang.String tagname, java.lang.String id)
          Returns an Element from a Document for a tagname and element id
static java.lang.String getElementValueForTagName(org.w3c.dom.Element anElem, java.lang.String tagname)
          Returns the value of an element for a given name
static java.lang.String getEntityName(java.lang.Class typClass, java.lang.String aKey)
          Returns a name from the EntityNameFinderService, for a key and class
static java.lang.String getEntityName(java.lang.String className, java.lang.String aKey)
          Returns a name from the EntityNameFinderService, for a key and classname
static java.util.HashMap getEntityTypes()
          Returns a HashMap of entity types.
static org.w3c.dom.Element getEntityTypesXml(org.w3c.dom.Document xmlDoc)
          Returns an element holding the entity types used in uPortal.
static org.w3c.dom.Element getExpandedElementForTagNameAndKey(org.w3c.dom.Document aDoc, java.lang.String tagname, java.lang.String key)
          Returns an Element with the expanded attribute set to true from a Document for a tagname and IGroupMember key.
static org.w3c.dom.Element getGroupMemberXml(IGroupMember gm, boolean isContextExpanded, org.w3c.dom.Element anElem, CGroupsManagerUnrestrictedSessionData sd)
          Returns an Element for an IGroupMember.
static org.w3c.dom.Document getGroupsManagerXml(CGroupsManagerSessionData sessionData)
          Returns a Document with an element for each IEntityType that has a root group.
static org.w3c.dom.Document getNewDocument()
          Returns a new Document
static java.lang.String getNextUid()
          Returns the next sequential identifier which is used to uniquely identify an element.
static java.util.Iterator getNodesById(org.w3c.dom.Document aDoc, java.lang.String id)
          Even though we know we will find a single element, we sometimes want it returned in an iterator in order to streamline processing.
static java.util.Iterator getNodesByTagNameAndKey(org.w3c.dom.Document aDoc, java.lang.String tagname, java.lang.String key)
          Returns an iterator of Nodes for a Document for a tagname and IGroupMember key
static java.util.Iterator getNodesByTagNameAndKey(org.w3c.dom.Element anElem, java.lang.String tagname, java.lang.String key)
          Returns an iterator of Nodes for an Element for a tagname and IGroupMember key
static org.w3c.dom.Element getPermissionXml(org.w3c.dom.Document xmlDoc, java.lang.String prmPrincipal, java.lang.String prmActivity, java.lang.String prmType, java.lang.String prmTarget)
          Returns an element for a permission.
static java.lang.String getTagName(IGroupMember gm)
          Returns the xml tagname for a GroupMember
static IGroupsManagerWrapper getWrapper(java.lang.String type)
          Returns a group member wrapper.
static boolean isPersistentGroup(org.w3c.dom.Element anElem)
          Group elements that hold search results are non-persistent and should be treated differently.
static void refreshAllNodes(CGroupsManagerUnrestrictedSessionData sd, IEntityGroup entGrp)
          Updates all nodes for the same IEntityGroup with information about the IEntityGroup.
static void refreshAllNodesIfRequired(CGroupsManagerUnrestrictedSessionData sd, org.w3c.dom.Element anElem)
          Updates all nodes representing the same IEntityGroup that is represented by the anElem, if the anElem is out of date with the IEntityGroup.
static void refreshAllNodesRecursivelyIfRequired(CGroupsManagerUnrestrictedSessionData sd, org.w3c.dom.Element parentElem)
          Updates all nodes representing the same IEntityGroup that is represented by the anElem, if the anElem is out of date with the IEntityGroup.
static void refreshElement(org.w3c.dom.Element updElem, IEntityGroup entGrp)
          Updates an Element with information about the IEntityGroup.
static boolean refreshRequired(org.w3c.dom.Element chkElem, IEntityGroup entGrp)
          Updates an Element with information about the IEntityGroup.
static void removeElementsForTagName(org.w3c.dom.Element anElem, java.lang.String tagname)
          Removes all elements with the tagname from an element
static void removePropertyElements(org.w3c.dom.Document model, IGroupMember gm, boolean clearCache)
          Removes all property elements for an IGroupMember and optionally clears the Entity Property cache.
static IEntity retrieveEntity(java.lang.String aKey, java.lang.String aType)
          Returns an IEntity for the key.
static IEntityGroup retrieveGroup(java.lang.String aKey)
          Returns an IEntityGroup for the key.
static IGroupMember retrieveGroupMemberForElement(org.w3c.dom.Element gmElem)
          Returns the IGroupMember represented by an Element
static IGroupMember retrieveGroupMemberForElementId(org.w3c.dom.Document aDoc, java.lang.String id)
          Returns the IGroupMember represented by an Element
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GroupsManagerXML

public GroupsManagerXML()
Method Detail

getGroupsManagerXml

public static org.w3c.dom.Document getGroupsManagerXml(CGroupsManagerSessionData sessionData)
Returns a Document with an element for each IEntityType that has a root group.

Parameters:
sessionData - CGroupsManagerSessionData
Returns:
Document

createElement

public static org.w3c.dom.Element createElement(java.lang.String name,
                                                org.w3c.dom.Document xmlDoc,
                                                boolean setGrpDefault)
Creates an element for the provided Document. Alternatively, can set default values.

Parameters:
name -
xmlDoc -
setGrpDefault -
Returns:
Element

createRdfElement

public static org.w3c.dom.Element createRdfElement(IEntityGroup entGrp,
                                                   org.w3c.dom.Document xmlDoc)
Returns an RDF element for the provided Document

Parameters:
entGrp - IEntityGroup
xmlDoc - Document
Returns:
Element

createPermissions

public static void createPermissions(CGroupsManagerSessionData sessionData,
                                     IEntityGroup childEntGrp)
                              throws java.lang.Exception
Creates permissions to a group for the current user and generates permission elements

Parameters:
sessionData - CGroupsManagerSessionData
childEntGrp - IEntityGroup
Throws:
java.lang.Exception

expandGroupElementXML

public static void expandGroupElementXML(org.w3c.dom.Element expandedElem,
                                         CGroupsManagerUnrestrictedSessionData sd)
Expands an element

Parameters:
expandedElem - Element
sd - CGroupsManagerUnrestrictedSessionData

getAuthorizationXml

public static org.w3c.dom.Element getAuthorizationXml(ChannelStaticData sd,
                                                      org.w3c.dom.Element apRoot,
                                                      org.w3c.dom.Document xmlDoc)
Returns an element holding the user's permissions used to determine access privileges in the Groups Manager channel.

Parameters:
sd -
apRoot -
xmlDoc -
Returns:
Element

getElementById

public static org.w3c.dom.Element getElementById(org.w3c.dom.Document aDoc,
                                                 java.lang.String id)
Returns an element from an xml document for a unique id. An error is displayed if more than one element is found.

Parameters:
aDoc -
id -
Returns:
Element

getElementByTagNameAndId

public static org.w3c.dom.Element getElementByTagNameAndId(org.w3c.dom.Document aDoc,
                                                           java.lang.String tagname,
                                                           java.lang.String id)
Returns an Element from a Document for a tagname and element id

Parameters:
aDoc -
tagname -
id -
Returns:
Element

getElementValueForTagName

public static java.lang.String getElementValueForTagName(org.w3c.dom.Element anElem,
                                                         java.lang.String tagname)
Returns the value of an element for a given name

Parameters:
anElem - Element
tagname - String
Returns:
String

getEntityName

public static java.lang.String getEntityName(java.lang.Class typClass,
                                             java.lang.String aKey)
Returns a name from the EntityNameFinderService, for a key and class

Parameters:
typClass -
aKey -
Returns:
String

getEntityName

public static java.lang.String getEntityName(java.lang.String className,
                                             java.lang.String aKey)
Returns a name from the EntityNameFinderService, for a key and classname

Parameters:
className -
aKey -
Returns:
String

getEntityTypes

public static java.util.HashMap getEntityTypes()
Returns a HashMap of entity types. These are the entity types that can be added to a group. We determine this by retrieving all entity types from the EntityTypes class and using the GroupService class to determine which types have a root group.

Returns:
HashMap

getEntityTypesXml

public static org.w3c.dom.Element getEntityTypesXml(org.w3c.dom.Document xmlDoc)
Returns an element holding the entity types used in uPortal.

Parameters:
xmlDoc -
Returns:
Element

getExpandedElementForTagNameAndKey

public static org.w3c.dom.Element getExpandedElementForTagNameAndKey(org.w3c.dom.Document aDoc,
                                                                     java.lang.String tagname,
                                                                     java.lang.String key)
Returns an Element with the expanded attribute set to true from a Document for a tagname and IGroupMember key. This could be used for cloning elements that have already be expanded thereby avoiding the extra time required to retrieve and create an element.

Parameters:
aDoc -
tagname -
key -
Returns:
Element

getGroupMemberXml

public static org.w3c.dom.Element getGroupMemberXml(IGroupMember gm,
                                                    boolean isContextExpanded,
                                                    org.w3c.dom.Element anElem,
                                                    CGroupsManagerUnrestrictedSessionData sd)
Returns an Element for an IGroupMember. If an element is passed in, it is acted upon (eg. expand the group), otherwise a new one is created.

Parameters:
gm -
isContextExpanded -
anElem -
sd - CGroupsManagerUnrestrictedSessionData
Returns:
Element

getNewDocument

public static org.w3c.dom.Document getNewDocument()
Returns a new Document

Returns:
Document

getNextUid

public static java.lang.String getNextUid()
Returns the next sequential identifier which is used to uniquely identify an element. This identifier is held in the Element "id" attribute. "0" is reserved for the Element holding the root group element.

Returns:
String

getNodesById

public static java.util.Iterator getNodesById(org.w3c.dom.Document aDoc,
                                              java.lang.String id)
Even though we know we will find a single element, we sometimes want it returned in an iterator in order to streamline processing.

Parameters:
aDoc -
id -
Returns:
iterator

getNodesByTagNameAndKey

public static java.util.Iterator getNodesByTagNameAndKey(org.w3c.dom.Document aDoc,
                                                         java.lang.String tagname,
                                                         java.lang.String key)
Returns an iterator of Nodes for a Document for a tagname and IGroupMember key

Parameters:
aDoc -
tagname -
key -
Returns:
Iterator

getNodesByTagNameAndKey

public static java.util.Iterator getNodesByTagNameAndKey(org.w3c.dom.Element anElem,
                                                         java.lang.String tagname,
                                                         java.lang.String key)
Returns an iterator of Nodes for an Element for a tagname and IGroupMember key

Parameters:
anElem -
tagname -
key -
Returns:
Iterator

getPermissionXml

public static org.w3c.dom.Element getPermissionXml(org.w3c.dom.Document xmlDoc,
                                                   java.lang.String prmPrincipal,
                                                   java.lang.String prmActivity,
                                                   java.lang.String prmType,
                                                   java.lang.String prmTarget)
Returns an element for a permission.

Parameters:
xmlDoc -
prmPrincipal -
prmActivity -
prmType -
prmTarget -
Returns:
Element

getWrapper

public static IGroupsManagerWrapper getWrapper(java.lang.String type)
Returns a group member wrapper.

Parameters:
type -
Returns:
IGroupsManagerWrapper

isPersistentGroup

public static boolean isPersistentGroup(org.w3c.dom.Element anElem)
Group elements that hold search results are non-persistent and should be treated differently. For example, they do not have a "key" attribute so code that attempts to retreive a GroupMember should not be attempted.

Parameters:
anElem - Element
Returns:
boolean

refreshAllNodes

public static void refreshAllNodes(CGroupsManagerUnrestrictedSessionData sd,
                                   IEntityGroup entGrp)
Updates all nodes for the same IEntityGroup with information about the IEntityGroup.

Parameters:
sd - CGroupsManagerUnrestrictedSessionData
entGrp - IEntityGroup

refreshAllNodesIfRequired

public static void refreshAllNodesIfRequired(CGroupsManagerUnrestrictedSessionData sd,
                                             org.w3c.dom.Element anElem)
Updates all nodes representing the same IEntityGroup that is represented by the anElem, if the anElem is out of date with the IEntityGroup.

Parameters:
sd - CGroupsManagerUnrestrictedSessionData
anElem - Element

refreshAllNodesRecursivelyIfRequired

public static void refreshAllNodesRecursivelyIfRequired(CGroupsManagerUnrestrictedSessionData sd,
                                                        org.w3c.dom.Element parentElem)
Updates all nodes representing the same IEntityGroup that is represented by the anElem, if the anElem is out of date with the IEntityGroup. Additionally, we do the same for each child node (one level down at this time).

Parameters:
sd - CGroupsManagerUnrestrictedSessionData
parentElem - Element

refreshElement

public static void refreshElement(org.w3c.dom.Element updElem,
                                  IEntityGroup entGrp)
Updates an Element with information about the IEntityGroup.

Parameters:
updElem - Element
entGrp - IEntityGroup

refreshRequired

public static boolean refreshRequired(org.w3c.dom.Element chkElem,
                                      IEntityGroup entGrp)
Updates an Element with information about the IEntityGroup.

Parameters:
chkElem - Element
entGrp - IEntityGroup
Returns:
boolean

retrieveEntity

public static IEntity retrieveEntity(java.lang.String aKey,
                                     java.lang.String aType)
Returns an IEntity for the key.

Parameters:
aKey -
aType -
Returns:
IEntity

retrieveGroup

public static IEntityGroup retrieveGroup(java.lang.String aKey)
Returns an IEntityGroup for the key.

Parameters:
aKey -
Returns:
IEntityGroup

retrieveGroupMemberForElementId

public static IGroupMember retrieveGroupMemberForElementId(org.w3c.dom.Document aDoc,
                                                           java.lang.String id)
Returns the IGroupMember represented by an Element

Parameters:
aDoc -
id -
Returns:
IGroupMember

retrieveGroupMemberForElement

public static IGroupMember retrieveGroupMemberForElement(org.w3c.dom.Element gmElem)
Returns the IGroupMember represented by an Element

Parameters:
gmElem -
Returns:
IGroupMember

getTagName

public static java.lang.String getTagName(IGroupMember gm)
Returns the xml tagname for a GroupMember

Parameters:
gm - IGroupMember
Returns:
String

removeElementsForTagName

public static void removeElementsForTagName(org.w3c.dom.Element anElem,
                                            java.lang.String tagname)
Removes all elements with the tagname from an element

Parameters:
anElem - Element
tagname - String

removePropertyElements

public static void removePropertyElements(org.w3c.dom.Document model,
                                          IGroupMember gm,
                                          boolean clearCache)
Removes all property elements for an IGroupMember and optionally clears the Entity Property cache.

Parameters:
model - Element
gm - IGroupMember
clearCache - boolean

clearPropertiesCache

public static void clearPropertiesCache(IGroupMember gm)
Removes all EntityProperites for a GroupMember from the Entity Property cache.

Parameters:
gm - IGroupMember

uPortal 2.4.1
API Documentation