Merged V2.1 to HEAD

6515: Fix for AWC-1362 (system error page when clicking on space that doesn't exist in navigator)
   6516: Fix for AR-1688 - Vista
   6518: Fix for AWC-1479, AWC-1199 and AWC-426 (javascript insertion into forum posts security related fixes) limit to subset of safe tags for posting
   6519: Fix AR-1690 Web Scripts url.args is missing even though it's documented in WIKI
   6520: Fix for AWC-1271 (component generator config ignored for associations)
   6521: Fix AWC-1492 Some included javascript files in template/webscripts use the wrong app context path i.e. /alfresco when the app is called /alfzip
   6522: Build fix
   6523: - Fix rendering of tasks with no description in office portlets
   6524: Added thread pool for index merging (AR-1633, AR-1579)
   6525: One more fix for rendering of tasks with no description in office portlets
   6527: Renamed axis jar to reflect version number.
   6528: WebServices query cache refactoring


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6741 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-09-10 23:44:07 +00:00
parent 6e5ac9d831
commit 794cbf4584
20 changed files with 360 additions and 49 deletions

View File

@@ -476,6 +476,113 @@ public class BrowseBean implements IContextListener
return result;
}
/**
* Page accessed bean method to get the parent container nodes currently being browsed
*
* @return List of parent container Node objects for the current browse location
*/
public List<Node> getParentNodes(NodeRef currNodeRef)
{
// As per AWC-1507 there are two scenarios for navigating to the space details. First
// scenario is to show space details of the current space. Second scenario is to show
// space details of a child space of the current space. For now, added an extra query
// so that existing context remains unaffected for second scenario, although it does
// mean that in first scenario there will be an extra query even though parentContainerNodes
// and containerNodes will contain the same list.
if (this.parentContainerNodes == null)
{
long startTime = 0;
if (logger.isDebugEnabled())
startTime = System.currentTimeMillis();
UserTransaction tx = null;
try
{
FacesContext context = FacesContext.getCurrentInstance();
tx = Repository.getUserTransaction(context, true);
tx.begin();
NodeRef parentRef = nodeService.getPrimaryParent(currNodeRef).getParentRef();
List<FileInfo> children = this.fileFolderService.list(parentRef);
this.parentContainerNodes = new ArrayList<Node>(children.size());
for (FileInfo fileInfo : children)
{
// create our Node representation from the NodeRef
NodeRef nodeRef = fileInfo.getNodeRef();
// find it's type so we can see if it's a node we are interested in
QName type = this.nodeService.getType(nodeRef);
// make sure the type is defined in the data dictionary
TypeDefinition typeDef = this.dictionaryService.getType(type);
if (typeDef != null)
{
MapNode node = null;
// look for Space folder node
if (this.dictionaryService.isSubClass(type, ContentModel.TYPE_FOLDER) == true &&
this.dictionaryService.isSubClass(type, ContentModel.TYPE_SYSTEM_FOLDER) == false)
{
// create our Node representation
node = new MapNode(nodeRef, this.nodeService, fileInfo.getProperties());
node.addPropertyResolver("icon", this.resolverSpaceIcon);
node.addPropertyResolver("smallIcon", this.resolverSmallIcon);
this.parentContainerNodes.add(node);
}
else if (ApplicationModel.TYPE_FOLDERLINK.equals(type))
{
// create our Folder Link Node representation
node = new MapNode(nodeRef, this.nodeService, fileInfo.getProperties());
node.addPropertyResolver("icon", this.resolverSpaceIcon);
node.addPropertyResolver("smallIcon", this.resolverSmallIcon);
this.parentContainerNodes.add(node);
}
}
else
{
if (logger.isEnabledFor(Priority.WARN))
logger.warn("Found invalid object in database: id = " + nodeRef + ", type = " + type);
}
}
// commit the transaction
tx.commit();
}
catch (InvalidNodeRefException refErr)
{
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(
FacesContext.getCurrentInstance(), Repository.ERROR_NODEREF), new Object[] {refErr.getNodeRef()}), refErr );
this.parentContainerNodes = Collections.<Node>emptyList();
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
}
catch (Throwable err)
{
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(
FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err);
this.parentContainerNodes = Collections.<Node>emptyList();
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
}
if (logger.isDebugEnabled())
{
long endTime = System.currentTimeMillis();
logger.debug("Time to query and build map parent nodes: " + (endTime - startTime) + "ms");
}
}
List<Node> result = this.parentContainerNodes;
// we clear the member variable during invalidateComponents()
return result;
}
/**
* Setup the common properties required at data-binding time.
@@ -1733,6 +1840,7 @@ public class BrowseBean implements IContextListener
// clear the storage of the last set of nodes
this.containerNodes = null;
this.contentNodes = null;
this.parentContainerNodes = null;
}
/**
@@ -1880,6 +1988,7 @@ public class BrowseBean implements IContextListener
/** Transient lists of container and content nodes for display */
protected List<Node> containerNodes = null;
protected List<Node> contentNodes = null;
protected List<Node> parentContainerNodes = null;
/** The current space and it's properties - if any */
protected Node actionSpace;

View File

@@ -177,7 +177,8 @@ public class SpaceDetailsBean extends BaseDetailsBean
String id = params.get("id");
if (id != null && id.length() != 0)
{
List<Node> nodes = this.browseBean.getNodes();
NodeRef currNodeRef = new NodeRef(Repository.getStoreRef(), id);
List<Node> nodes = this.browseBean.getParentNodes(currNodeRef);
if (nodes.size() > 1)
{
// perform a linear search - this is slow but stateless
@@ -214,7 +215,6 @@ public class SpaceDetailsBean extends BaseDetailsBean
// to the default one.
if (foundNextItem == false)
{
NodeRef currNodeRef = new NodeRef(Repository.getStoreRef(), id);
Node currNode = new Node(currNodeRef);
this.navigator.setupDispatchContext(currNode);
}
@@ -232,7 +232,8 @@ public class SpaceDetailsBean extends BaseDetailsBean
String id = params.get("id");
if (id != null && id.length() != 0)
{
List<Node> nodes = this.browseBean.getNodes();
NodeRef currNodeRef = new NodeRef(Repository.getStoreRef(), id);
List<Node> nodes = this.browseBean.getParentNodes(currNodeRef);
if (nodes.size() > 1)
{
// see above
@@ -266,7 +267,6 @@ public class SpaceDetailsBean extends BaseDetailsBean
// to the default one.
if (foundPreviousItem == false)
{
NodeRef currNodeRef = new NodeRef(Repository.getStoreRef(), id);
Node currNode = new Node(currNodeRef);
this.navigator.setupDispatchContext(currNode);
}

View File

@@ -831,7 +831,7 @@ public class ForumsBean implements IContextListener
if (reader != null)
{
content = reader.getContentString();
content = Utils.stripUnsafeHTMLTags(reader.getContentString());
}
return content;