|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jasig.portal.layout.alm.AggregatedLayoutManager
public class AggregatedLayoutManager
An implementation of Aggregated User Layout Manager Interface defining common operations on user layout nodes, that is channels and folders. Prior to uPortal 2.5, this class existed in the package org.jasig.portal.layout. It was moved to its present package to reflect that it is part of Aggregated Layouts.
Field Summary | |
---|---|
private IALNodeDescription |
addTargetsNodeDesc
|
private java.lang.String |
cacheKey
|
private java.lang.String |
fragmentId
|
private static GuidGenerator |
guid
|
private AggregatedLayout |
layout
|
private AggregatedUserLayoutStore |
layoutStore
|
private java.util.Set |
listeners
|
private static org.apache.commons.logging.Log |
log
|
private java.lang.String |
moveTargetsNodeId
|
private IPerson |
person
|
private IALRestrictionManager |
restrictionManager
|
private UserProfile |
userProfile
|
Fields inherited from interface org.jasig.portal.layout.alm.IAggregatedUserLayoutManager |
---|
NEW_FRAGMENT, PRIORITY_COEFF |
Constructor Summary | |
---|---|
AggregatedLayoutManager(IPerson person,
UserProfile userProfile)
|
|
AggregatedLayoutManager(IPerson person,
UserProfile userProfile,
IUserLayoutStore layoutStore)
|
Method Summary | |
---|---|
boolean |
addLayoutEventListener(LayoutEventListener l)
Register a layout event listener |
IUserLayoutNodeDescription |
addNode(IUserLayoutNodeDescription nodeDesc,
java.lang.String parentId,
java.lang.String nextSiblingId)
Add a new node to a current user layout. |
boolean |
canAddNode(IUserLayoutNodeDescription nodeDesc,
java.lang.String parentId,
java.lang.String nextSiblingId)
Test if a particular node can be added at a given location. |
boolean |
canDeleteNode(java.lang.String nodeId)
Tests if a particular node can be deleted. |
boolean |
canMoveNode(java.lang.String nodeId,
java.lang.String parentId,
java.lang.String nextSiblingId)
Test if a particular node can be moved to a given location. |
boolean |
canUpdateNode(IUserLayoutNodeDescription nodeDescription)
Test if a certain node can be updated. |
private void |
changeDescendantsBooleanProperties(boolean hiddenValuesMatch,
boolean immutableValuesMatch,
boolean unremovableValuesMatch,
IALNodeDescription nodeDesc,
java.lang.String nodeId)
|
private void |
changeDescendantsBooleanProperties(IALNodeDescription nodeDesc,
IALNodeDescription oldNodeDesc,
java.lang.String nodeId)
|
protected boolean |
changeSiblingNodesOrder(java.lang.String firstNodeId)
Change the sibling nodes order depending on their priority values |
protected boolean |
changeSiblingNodesPriorities(ALNode node,
java.lang.String parentNodeId,
java.lang.String nextNodeId)
Change priority values for all the sibling nodes when trying to add a new node |
protected boolean |
changeSiblingNodesPriorities(java.lang.String nodeId)
Change if it's possible priority values for all the sibling nodes |
protected boolean |
changeSiblingNodesPriorities(java.util.Vector nodes)
Change if it's possible priority values for all the sibling nodes defined by the collection |
private void |
cleanLayoutData(java.lang.String nodeId,
boolean result)
|
java.lang.String |
createFragment(java.lang.String fragmentName,
java.lang.String fragmentDesc,
java.lang.String fragmentRootName)
Creates a new fragment and loads it as an user layout |
IUserLayoutNodeDescription |
createNodeDescription(int nodeType)
A factory method to create an empty IUserLayoutNodeDescription instance |
void |
deleteFragment()
Deletes the current fragment if the layout is a fragment |
void |
deleteFragment(java.lang.String fragmentId)
Removes the fragment |
boolean |
deleteNode(java.lang.String nodeId)
Delete a node (folder or a channel) from a user layout. |
java.lang.String |
getCacheKey()
Return a cache key, uniqly corresponding to the composition and the structure of the user layout. |
java.util.Enumeration |
getChildIds(java.lang.String nodeId)
Returns a list of child node Ids for a given node. |
int |
getDepth(java.lang.String nodeId)
Gets the tree depth for a given node |
private ALNode |
getFirstSiblingNode(java.lang.String nodeId)
|
ILayoutFragment |
getFragment(java.lang.String fragmentId)
Returns the fragment |
java.util.Collection |
getFragments()
Returns the fragment Ids of the owner associated with the current layout |
private ALNode |
getLastSiblingNode(java.lang.String nodeId)
|
private ALFolder |
getLayoutFolder(java.lang.String folderId)
|
int |
getLayoutId()
Returns an Id of the current user layout. |
private ALNode |
getLayoutNode(java.lang.String nodeId)
|
java.lang.String |
getLostFolderXML()
|
java.lang.String |
getNextSiblingId(java.lang.String nodeId)
Determine an Id of a next sibling node. |
IUserLayoutNodeDescription |
getNode(java.lang.String nodeId)
Obtain a description of a node (channel or a folder) in a given user layout. |
IALNodeDescription |
getNodeBeingAdded()
Returns the description of the node currently being added to the layout |
IALNodeDescription |
getNodeBeingMoved()
Returns the description of the node currently being moved in the layout |
java.lang.String |
getParentId(java.lang.String nodeId)
Returns an Id of a parent user layout node. |
java.lang.String |
getPreviousSiblingId(java.lang.String nodeId)
Determine an Id of a previous sibling node. |
static PriorityRestriction |
getPriorityRestriction(ALNode node)
Return a priority restriction for the given node. |
private static PriorityRestriction |
getPriorityRestriction(ALNode node,
java.lang.String restrictionPath)
Return a priority restriction for the given node. |
java.util.Collection |
getPublishGroups(java.lang.String fragmentId)
Returns the user group keys which the fragment is published to |
private static IUserLayoutRestriction |
getRestriction(ALNode node,
java.lang.String restrictionName,
java.lang.String restrictionPath)
Gets the restriction specified by the parameters below |
java.lang.String |
getRootFolderId()
Returns an id of the root folder. |
java.util.Collection |
getSubscribableFragments()
Returns the list of Ids of the fragments that the user can subscribe to |
java.lang.String |
getSubscribeId(java.lang.String fname)
Returns a subscription id given a functional name. |
IUserLayout |
getUserLayout()
Gets a user layout (with appropriate markings). |
void |
getUserLayout(org.xml.sax.ContentHandler contentHandler)
Output a tree of a user layout (with appropriate markings) defined by a particular node into a ContentHandler |
void |
getUserLayout(java.lang.String nodeId,
org.xml.sax.ContentHandler contentHandler)
Output subtree of a user layout (with appropriate markings) defined by a particular node into a ContentHandler |
org.w3c.dom.Document |
getUserLayoutDOM()
|
boolean |
isFragmentLoaded()
Returns true if any fragment is currently loaded into the layout manager, false - otherwise |
private boolean |
isLayoutFragment()
|
private boolean |
isNodeFolderOrChannel(org.w3c.dom.Element node)
|
void |
loadFragment(java.lang.String fragmentId)
Loads the fragment as an user layout given by fragmentId |
void |
loadUserLayout()
Signal manager to load a user layout from a database |
void |
markAddTargets(IUserLayoutNodeDescription nodeDesc)
Ask manager to output markings at the locations where a given node can be added. |
void |
markMoveTargets(java.lang.String nodeId)
Ask manager to output markings at the locations where a given node can be moved. |
boolean |
moveNode(java.lang.String nodeId,
java.lang.String parentId,
java.lang.String nextSiblingId)
Moves a node to a place in the tree denoted by parent and next sibling. |
private boolean |
moveNodeToLostFolder(java.lang.String nodeId)
Moves the node to the lost folder |
private void |
moveWrongFragmentsToLostFolder()
|
protected void |
moveWrongNodesToLostFolder()
Moves the nodes to the lost folder if they don't satisfy their restrictions |
private void |
moveWrongNodesToLostFolder(java.lang.String nodeId,
int depth)
Moves the nodes to the lost folder if they don't satisfy their restrictions |
boolean |
removeLayoutEventListener(LayoutEventListener l)
Remove a registered layout event listener. |
void |
saveFragment()
Saves the current fragment if the layout is a fragment |
void |
saveFragment(ILayoutFragment fragment)
Saves the fragment in the store |
void |
saveUserLayout()
Signal manager to persist user layout to a database |
void |
setAutoCommit(boolean autoCommit)
Deprecated. this method no longer has any effect |
void |
setLayoutStore(IUserLayoutStore layoutStore)
Set a user layout store implementation. |
void |
setPublishGroups(IGroupMember[] groups,
java.lang.String fragmentId)
Persists the user groups which the fragment is published to |
void |
setUserLayout(IUserLayout layout)
Sets a user layout (with appropriate markings). |
void |
setUserLayoutDOM(org.w3c.dom.Document domLayout)
|
private void |
setUserLayoutDOM(org.w3c.dom.Node n,
java.lang.String parentNodeId,
java.util.Hashtable layoutData)
|
private void |
updateCacheKey()
|
boolean |
updateNode(IUserLayoutNodeDescription nodeDesc)
Update a given node. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final org.apache.commons.logging.Log log
private IALRestrictionManager restrictionManager
private AggregatedUserLayoutStore layoutStore
private AggregatedLayout layout
private UserProfile userProfile
private IPerson person
private java.util.Set listeners
private IALNodeDescription addTargetsNodeDesc
private java.lang.String moveTargetsNodeId
private java.lang.String fragmentId
private static GuidGenerator guid
private java.lang.String cacheKey
Constructor Detail |
---|
public AggregatedLayoutManager(IPerson person, UserProfile userProfile) throws PortalException
PortalException
public AggregatedLayoutManager(IPerson person, UserProfile userProfile, IUserLayoutStore layoutStore) throws java.lang.Exception
java.lang.Exception
Method Detail |
---|
private void updateCacheKey()
public IUserLayout getUserLayout() throws PortalException
IUserLayoutManager
getUserLayout
in interface IUserLayoutManager
PortalException
- if an error occurspublic void setUserLayout(IUserLayout layout) throws PortalException
IUserLayoutManager
setUserLayout
in interface IUserLayoutManager
layout
- the user layout
PortalException
- if an error occurspublic IUserLayoutNodeDescription createNodeDescription(int nodeType) throws PortalException
IUserLayoutNodeDescription
instance
createNodeDescription
in interface IUserLayoutManager
nodeType
- a node type value
IUserLayoutNodeDescription
instance
PortalException
- if the error occurs.public void setAutoCommit(boolean autoCommit)
setAutoCommit
in interface IAggregatedUserLayoutManager
autoCommit
- a boolean valuepublic int getLayoutId()
getLayoutId
in interface IUserLayoutManager
int
valuepublic java.lang.String getParentId(java.lang.String nodeId) throws PortalException
IUserLayout.ROOT_NODE_NAME
getParentId
in interface IUserLayoutManager
nodeId
- a String
value
String
value
PortalException
- if an error occurspublic java.util.Enumeration getChildIds(java.lang.String nodeId) throws PortalException
getChildIds
in interface IUserLayoutManager
nodeId
- a String
value
Enumeration
of String
child node Ids.
PortalException
- if an error occurspublic java.lang.String getPreviousSiblingId(java.lang.String nodeId) throws PortalException
getPreviousSiblingId
in interface IUserLayoutManager
nodeId
- a String
node ID
String
Id value of a previous sibling node, or null
if this is the first sibling.
PortalException
- if an error occurspublic java.lang.String getNextSiblingId(java.lang.String nodeId) throws PortalException
getNextSiblingId
in interface IUserLayoutManager
nodeId
- a String
node ID
String
Id value of a next sibling node, or null
if this is the last sibling.
PortalException
- if an error occursprivate void moveWrongFragmentsToLostFolder() throws PortalException
PortalException
protected void moveWrongNodesToLostFolder() throws PortalException
PortalException
- if an error occursprivate void moveWrongNodesToLostFolder(java.lang.String nodeId, int depth) throws PortalException
nodeId
- a String
node IDdepth
- a depth of the given node
PortalException
- if an error occurspublic java.lang.String getLostFolderXML() throws PortalException
PortalException
public int getDepth(java.lang.String nodeId) throws PortalException
getDepth
in interface IUserLayoutManager
nodeId
- a String
node ID
PortalException
- if an error occursprivate boolean moveNodeToLostFolder(java.lang.String nodeId) throws PortalException
nodeId
- a String
node ID
PortalException
- if an error occursprivate static IUserLayoutRestriction getRestriction(ALNode node, java.lang.String restrictionName, java.lang.String restrictionPath) throws PortalException
node
- a ALNode
noderestrictionName
- a restriction namerestrictionPath
- a String
restriction path
IUserLayoutRestriction
instance
PortalException
- if an error occurspublic static PriorityRestriction getPriorityRestriction(ALNode node) throws PortalException
PriorityRestriction
object
PortalException
- if an error occursprivate static PriorityRestriction getPriorityRestriction(ALNode node, java.lang.String restrictionPath) throws PortalException
PriorityRestriction
object
PortalException
- if an error occursprotected boolean changeSiblingNodesPriorities(java.lang.String nodeId) throws PortalException
nodeId
- a String
any node ID from the sibling line to be checked
PortalException
- if an error occursprotected boolean changeSiblingNodesPriorities(java.util.Vector nodes) throws PortalException
nodes
- a Vector
instance with ALNode objects
PortalException
- if an error occursprotected boolean changeSiblingNodesPriorities(ALNode node, java.lang.String parentNodeId, java.lang.String nextNodeId) throws PortalException
node
- a ALNode
a node to be addedparentNodeId
- a String
parent node IDnextNodeId
- a String
next sibling node ID
PortalException
- if an error occursprotected boolean changeSiblingNodesOrder(java.lang.String firstNodeId) throws PortalException
firstNodeId
- a String
first node ID in the sibling line
PortalException
- if an error occurspublic java.lang.String getCacheKey() throws PortalException
getCacheKey
in interface IUserLayoutManager
String
value
PortalException
- if an error occurspublic void getUserLayout(org.xml.sax.ContentHandler contentHandler) throws PortalException
ContentHandler
getUserLayout
in interface IUserLayoutManager
contentHandler
- a ContentHandler
value
PortalException
- if an error occurspublic void getUserLayout(java.lang.String nodeId, org.xml.sax.ContentHandler contentHandler) throws PortalException
ContentHandler
getUserLayout
in interface IUserLayoutManager
nodeId
- a String
a node determining a user layout subtree.contentHandler
- a ContentHandler
value
PortalException
- if an error occursprivate ALNode getLayoutNode(java.lang.String nodeId)
private ALFolder getLayoutFolder(java.lang.String folderId)
private ALNode getLastSiblingNode(java.lang.String nodeId)
private ALNode getFirstSiblingNode(java.lang.String nodeId)
public org.w3c.dom.Document getUserLayoutDOM() throws PortalException
getUserLayoutDOM
in interface IUserLayoutManager
PortalException
private void setUserLayoutDOM(org.w3c.dom.Node n, java.lang.String parentNodeId, java.util.Hashtable layoutData) throws PortalException
PortalException
public void setUserLayoutDOM(org.w3c.dom.Document domLayout) throws PortalException
PortalException
private boolean isNodeFolderOrChannel(org.w3c.dom.Element node)
public void setLayoutStore(IUserLayoutStore layoutStore)
IUserLayoutManager
setLayoutStore
in interface IUserLayoutManager
layoutStore
- an IUserLayoutStore
valuepublic void loadUserLayout() throws PortalException
IUserLayoutManager
loadUserLayout
in interface IUserLayoutManager
PortalException
- if an error occurspublic boolean isFragmentLoaded() throws PortalException
isFragmentLoaded
in interface IAggregatedUserLayoutManager
PortalException
- if an error occurspublic void saveUserLayout() throws PortalException
IUserLayoutManager
saveUserLayout
in interface IUserLayoutManager
PortalException
- if an error occurspublic void saveFragment(ILayoutFragment fragment) throws PortalException
IAggregatedUserLayoutManager
saveFragment
in interface IAggregatedUserLayoutManager
fragment
- a ILayoutFragment
instance
PortalException
- if an error occurspublic void deleteFragment(java.lang.String fragmentId) throws PortalException
IAggregatedUserLayoutManager
deleteFragment
in interface IAggregatedUserLayoutManager
fragmentId
- a fragment ID
PortalException
- if an error occurspublic java.util.Collection getSubscribableFragments() throws PortalException
getSubscribableFragments
in interface IAggregatedUserLayoutManager
Collection
a set of the fragment IDs
PortalException
- if an error occurspublic java.util.Collection getFragments() throws PortalException
IAggregatedUserLayoutManager
getFragments
in interface IAggregatedUserLayoutManager
Collection
a set of the fragment IDs
PortalException
- if an error occurspublic java.util.Collection getPublishGroups(java.lang.String fragmentId) throws PortalException
getPublishGroups
in interface IAggregatedUserLayoutManager
fragmentId
- a String
value
Collection
object containing the group keys
PortalException
- if an error occurspublic void setPublishGroups(IGroupMember[] groups, java.lang.String fragmentId) throws PortalException
setPublishGroups
in interface IAggregatedUserLayoutManager
groups
- an array of IGroupMember
objectsfragmentId
- a String
value
PortalException
- if an error occurspublic ILayoutFragment getFragment(java.lang.String fragmentId) throws PortalException
IAggregatedUserLayoutManager
getFragment
in interface IAggregatedUserLayoutManager
fragmentId
- a fragment ID
ILayoutFragment
a fragment
PortalException
- if an error occurspublic java.lang.String createFragment(java.lang.String fragmentName, java.lang.String fragmentDesc, java.lang.String fragmentRootName) throws PortalException
IAggregatedUserLayoutManager
createFragment
in interface IAggregatedUserLayoutManager
fragmentName
- a fragment namefragmentDesc
- a fragment descriptionfragmentRootName
- a fragment root node name
PortalException
- if an error occurspublic void loadFragment(java.lang.String fragmentId) throws PortalException
IAggregatedUserLayoutManager
loadFragment
in interface IAggregatedUserLayoutManager
fragmentId
- a fragment ID
PortalException
- if an error occurspublic void saveFragment() throws PortalException
IAggregatedUserLayoutManager
saveFragment
in interface IAggregatedUserLayoutManager
PortalException
- if an error occurspublic void deleteFragment() throws PortalException
deleteFragment
in interface IAggregatedUserLayoutManager
PortalException
- if an error occursprivate boolean isLayoutFragment()
public IUserLayoutNodeDescription getNode(java.lang.String nodeId) throws PortalException
IUserLayoutManager
getNode
in interface IUserLayoutManager
nodeId
- a String
channel subscribe id or folder id.
UserLayoutNodeDescription
value
PortalException
- if an error occurspublic boolean moveNode(java.lang.String nodeId, java.lang.String parentId, java.lang.String nextSiblingId) throws PortalException
moveNode
in interface IUserLayoutManager
nodeId
- node to be movedparentId
- parent of where nodeId should be movednextSiblingId
- nextSibling of where nodeId should be moved
boolean
value noting if the operation was successful
PortalException
- if an error occurspublic boolean deleteNode(java.lang.String nodeId) throws PortalException
IUserLayoutManager
deleteNode
in interface IUserLayoutManager
nodeId
- a String
id (channel subscribe id or folder id)
boolean
value noting if the operation was successful
PortalException
- if an error occursprivate void cleanLayoutData(java.lang.String nodeId, boolean result) throws PortalException
PortalException
public IUserLayoutNodeDescription addNode(IUserLayoutNodeDescription nodeDesc, java.lang.String parentId, java.lang.String nextSiblingId) throws PortalException
IUserLayoutManager
addNode
in interface IUserLayoutManager
nodeDesc
- an UserLayoutNodeDescription
value of a node to be added (Id doesn't have to be set)parentId
- a String
id of a folder to which the new node (channel or folder) should be added.nextSiblingId
- a String
an id of a sibling node (channel or folder) prior to which the new node should be inserted.
UserLayoutNodeDescription
value with a newly determined Id.
PortalException
- if an error occursprivate void changeDescendantsBooleanProperties(IALNodeDescription nodeDesc, IALNodeDescription oldNodeDesc, java.lang.String nodeId) throws PortalException
PortalException
private void changeDescendantsBooleanProperties(boolean hiddenValuesMatch, boolean immutableValuesMatch, boolean unremovableValuesMatch, IALNodeDescription nodeDesc, java.lang.String nodeId) throws PortalException
PortalException
public boolean updateNode(IUserLayoutNodeDescription nodeDesc) throws PortalException
IUserLayoutManager
updateNode
in interface IUserLayoutManager
nodeDesc
- an UserLayoutNodeDescription
value with a valid id.
boolean
value noting if the operation was successful
PortalException
- if an error occurspublic boolean canAddNode(IUserLayoutNodeDescription nodeDesc, java.lang.String parentId, java.lang.String nextSiblingId) throws PortalException
IUserLayoutManager
canAddNode
in interface IUserLayoutManager
nodeDesc
- an UserLayoutNodeDescription
value describing the node to be added.parentId
- a String
id of a parent to which the node to be added.nextSiblingId
- a String
id of a sibling prior to which the node to be inserted. (null
to append at the end)
boolean
value
PortalException
- if an error occurspublic boolean canMoveNode(java.lang.String nodeId, java.lang.String parentId, java.lang.String nextSiblingId) throws PortalException
IUserLayoutManager
canMoveNode
in interface IUserLayoutManager
nodeId
- a String
id of a node to be moved.parentId
- a String
id of a parent to which the node to be moved.nextSiblingId
- a String
id of a sibling prior to which the node is to be inserted (null
to append at the end)
boolean
value
PortalException
- if an error occurspublic boolean canDeleteNode(java.lang.String nodeId) throws PortalException
IUserLayoutManager
canDeleteNode
in interface IUserLayoutManager
nodeId
- a String
node id.
boolean
value
PortalException
- if an error occurspublic boolean canUpdateNode(IUserLayoutNodeDescription nodeDescription) throws PortalException
IUserLayoutManager
canUpdateNode
in interface IUserLayoutManager
nodeDescription
- a IUserLayoutNodeDescription
node id.
boolean
value
PortalException
- if an error occurspublic void markAddTargets(IUserLayoutNodeDescription nodeDesc) throws PortalException
IUserLayoutManager
getUserLayout
method is called.
markAddTargets
in interface IUserLayoutManager
nodeDesc
- an UserLayoutNodeDescription
value or null
to stop outputting add markings.
PortalException
- if an error occurspublic void markMoveTargets(java.lang.String nodeId) throws PortalException
IUserLayoutManager
getUserLayout
method is called.
markMoveTargets
in interface IUserLayoutManager
nodeId
- a String
value or null
to stop outputting move markings.
PortalException
- if an error occurspublic IALNodeDescription getNodeBeingAdded() throws PortalException
getNodeBeingAdded
in interface IAggregatedUserLayoutManager
IALNodeDescription
object
PortalException
- if an error occurspublic IALNodeDescription getNodeBeingMoved() throws PortalException
getNodeBeingMoved
in interface IAggregatedUserLayoutManager
IALNodeDescription
object
PortalException
- if an error occurspublic boolean addLayoutEventListener(LayoutEventListener l)
IUserLayoutManager
addLayoutEventListener
in interface IUserLayoutManager
l
- a LayoutEventListener
object
boolean
success statuspublic boolean removeLayoutEventListener(LayoutEventListener l)
IUserLayoutManager
removeLayoutEventListener
in interface IUserLayoutManager
l
- a LayoutEventListener
object
boolean
success statuspublic java.lang.String getRootFolderId()
getRootFolderId
in interface IUserLayoutManager
String
valuepublic java.lang.String getSubscribeId(java.lang.String fname) throws PortalException
getSubscribeId
in interface IUserLayoutManager
fname
- the functional name to lookup.
String
subscription id.
PortalException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |