[portal-commits] JBoss Portal SVN: r13026 - in branches/Enterprise_Portal_Platform_4_3/core/src/main/org/jboss/portal/core: model/portal and 1 other directory.
portal-commits at lists.jboss.org
portal-commits at lists.jboss.org
Fri Mar 13 09:04:17 EDT 2009
Author: thomas.heute at jboss.com
Date: 2009-03-13 09:04:17 -0400 (Fri, 13 Mar 2009)
New Revision: 13026
Modified:
branches/Enterprise_Portal_Platform_4_3/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java
branches/Enterprise_Portal_Platform_4_3/core/src/main/org/jboss/portal/core/model/portal/PortalObjectId.java
Log:
JBEPP-40: Performance degrades as number of portal objects/dashboard increases
Modified: branches/Enterprise_Portal_Platform_4_3/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java 2009-03-13 12:51:40 UTC (rev 13025)
+++ branches/Enterprise_Portal_Platform_4_3/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java 2009-03-13 13:04:17 UTC (rev 13026)
@@ -409,16 +409,14 @@
public PortalObject getChild(String name)
{
ParameterValidation.throwIllegalArgExceptionIfNull(name, "child name");
- ObjectNode childNode = (ObjectNode)objectNode.getChildren().get(name);
- if (childNode != null)
- {
- PortalObjectImpl childObject = childNode.getObject();
- // Track it
- getAccessedChildren().add(childObject);
-
- //
- return childObject;
+ // use container directly instead of going through children to avoid having to retrieve all of them just for one
+ // this leads to major perfomance improvement by dramatically reducing the number of DB requests
+ PortalObject portalObject = objectNode.getContext().getContainer().getObject(getId().getChildId(name));
+ if (portalObject != null)
+ {
+ getAccessedChildren().add(portalObject);
+ return portalObject;
}
else
{
Modified: branches/Enterprise_Portal_Platform_4_3/core/src/main/org/jboss/portal/core/model/portal/PortalObjectId.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/core/src/main/org/jboss/portal/core/model/portal/PortalObjectId.java 2009-03-13 12:51:40 UTC (rev 13025)
+++ branches/Enterprise_Portal_Platform_4_3/core/src/main/org/jboss/portal/core/model/portal/PortalObjectId.java 2009-03-13 13:04:17 UTC (rev 13026)
@@ -22,6 +22,8 @@
******************************************************************************/
package org.jboss.portal.core.model.portal;
+import org.jboss.portal.common.util.ParameterValidation;
+
import java.io.Serializable;
/**
@@ -60,14 +62,8 @@
*/
public PortalObjectId(String namespace, PortalObjectPath path) throws IllegalArgumentException
{
- if (namespace == null)
- {
- throw new IllegalArgumentException();
- }
- if (path == null)
- {
- throw new IllegalArgumentException();
- }
+ ParameterValidation.throwIllegalArgExceptionIfNull(namespace, "namespace");
+ ParameterValidation.throwIllegalArgExceptionIfNull(path, "path");
this.namespace = namespace;
this.path = path;
}
@@ -125,10 +121,7 @@
*/
public static PortalObjectId parse(String idValue, PortalObjectPath.Format format) throws IllegalArgumentException
{
- if (idValue == null)
- {
- throw new IllegalArgumentException("No null id value accepted");
- }
+ ParameterValidation.throwIllegalArgExceptionIfNull(idValue, "id");
int pos = idValue.indexOf(NAMESPACE_SEPARATOR);
//
@@ -144,6 +137,12 @@
}
}
+ public PortalObjectId getChildId(String name)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(name, "child name");
+ return new PortalObjectId(getNamespace(), getPath().getChild(name));
+ }
+
/**
* Parse a portal object id given the namespace and the path string representation.
*
@@ -177,10 +176,7 @@
*/
public String toString(PortalObjectPath.Format format) throws IllegalArgumentException
{
- if (format == null)
- {
- throw new IllegalArgumentException("No null format accepted");
- }
+ ParameterValidation.throwIllegalArgExceptionIfNull(format, "format");
//
if (format == PortalObjectPath.LEGACY_FORMAT)
@@ -216,14 +212,8 @@
*/
public static String toString(String namespace, PortalObjectPath path, PortalObjectPath.Format format) throws IllegalArgumentException
{
- if (namespace == null)
- {
- throw new IllegalArgumentException("No null namespace accepted");
- }
- if (path == null)
- {
- throw new IllegalArgumentException("No null path accepted");
- }
+ ParameterValidation.throwIllegalArgExceptionIfNull(namespace, "namespace");
+ ParameterValidation.throwIllegalArgExceptionIfNull(path, "path");
if (namespace.length() > 0)
{
return namespace + NAMESPACE_SEPARATOR + path.toString(format);
More information about the portal-commits
mailing list