Author: julien(a)jboss.com
Date: 2007-05-06 17:43:31 -0400 (Sun, 06 May 2007)
New Revision: 7205
Added:
trunk/core/src/main/org/jboss/portal/core/model/portal/Context.java
Modified:
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/ContextImpl.java
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/WindowImpl.java
trunk/core/src/main/org/jboss/portal/core/model/portal/Window.java
trunk/core/src/resources/portal-core-sar/conf/hibernate/portal/domain.hbm.xml
Log:
- added missing Context interface
- renamed instanceRef -> URI field on the WindowImpl object (need to keep the
underlying DB field instanceRef though)
- added convenient Window.getPage() method
Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/portal/ContextImpl.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/ContextImpl.java 2007-05-06
21:05:30 UTC (rev 7204)
+++
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/ContextImpl.java 2007-05-06
21:43:31 UTC (rev 7205)
@@ -26,6 +26,7 @@
import org.jboss.portal.core.model.portal.DuplicatePortalObjectException;
import org.jboss.portal.core.model.portal.Portal;
import org.jboss.portal.core.model.portal.PortalObject;
+import org.jboss.portal.core.model.portal.Context;
import java.util.HashMap;
@@ -33,7 +34,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
-public class ContextImpl extends PortalObjectImpl implements PortalContainer
+public class ContextImpl extends PortalObjectImpl implements Context
{
public ContextImpl()
Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/portal/WindowImpl.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/model/portal/WindowImpl.java 2007-05-06
21:05:30 UTC (rev 7204)
+++ trunk/core/src/main/org/jboss/portal/core/impl/model/portal/WindowImpl.java 2007-05-06
21:43:31 UTC (rev 7205)
@@ -24,6 +24,7 @@
import org.jboss.portal.core.model.portal.PortalObject;
import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.core.model.portal.Page;
import org.jboss.portal.core.model.content.Content;
import org.jboss.portal.core.model.content.ContentType;
import org.jboss.portal.core.model.content.spi.handler.ContentState;
@@ -43,7 +44,7 @@
public static final String PORTAL_PROP_WINDOW_CONTENT_TYPE =
"portal.windowContentType";
// Persistent state
- protected String instanceRef;
+ protected String uri;
// Runtime fields
protected AbstractPortalObjectContainer.Context context;
@@ -56,7 +57,7 @@
//
this.contentType = null;
- this.instanceRef = null;
+ this.uri = null;
}
/**
@@ -81,7 +82,7 @@
//
this.contentType = contentType;
- this.instanceRef = contentURI;
+ this.uri = contentURI;
//
setDeclaredProperty(PORTAL_PROP_WINDOW_CONTENT_TYPE, contentType.toString());
@@ -101,16 +102,21 @@
this.context = (AbstractPortalObjectContainer.Context)context;
}
- public String getInstanceRef()
+ public String getURI()
{
- return instanceRef;
+ return uri;
}
- public void setInstanceRef(String instanceRef)
+ public void setURI(String uri)
{
- this.instanceRef = instanceRef;
+ this.uri = uri;
}
+ public Page getPage()
+ {
+ return (Page)getParent();
+ }
+
public Content getContent()
{
return getContentState().getContent();
@@ -134,11 +140,6 @@
return contentType;
}
- public String getURI()
- {
- return instanceRef;
- }
-
public int getType()
{
return PortalObject.TYPE_WINDOW;
@@ -147,7 +148,7 @@
protected PortalObjectImpl cloneObject()
{
WindowImpl clone = new WindowImpl();
- clone.setInstanceRef(instanceRef);
+ clone.setURI(uri);
clone.setDeclaredPropertyMap(new HashMap(getDeclaredPropertyMap()));
clone.setListener(getListener());
return clone;
@@ -173,12 +174,12 @@
public String getURI()
{
- return instanceRef;
+ return WindowImpl.this.uri;
}
public void setURI(String uri)
{
- instanceRef = uri;
+ WindowImpl.this.uri = uri;
}
private void destroy()
Added: trunk/core/src/main/org/jboss/portal/core/model/portal/Context.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/Context.java
(rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/Context.java 2007-05-06
21:43:31 UTC (rev 7205)
@@ -0,0 +1,31 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.model.portal;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface Context extends PortalContainer
+{
+}
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/Window.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/Window.java 2007-05-06 21:05:30
UTC (rev 7204)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/Window.java 2007-05-06 21:43:31
UTC (rev 7205)
@@ -33,7 +33,15 @@
*/
public interface Window extends PortalObject
{
+
/**
+ * Return the page containing this window.
+ *
+ * @return the page
+ */
+ Page getPage();
+
+ /**
* Return the window content type.
*
* @return the window content type
Modified: trunk/core/src/resources/portal-core-sar/conf/hibernate/portal/domain.hbm.xml
===================================================================
---
trunk/core/src/resources/portal-core-sar/conf/hibernate/portal/domain.hbm.xml 2007-05-06
21:05:30 UTC (rev 7204)
+++
trunk/core/src/resources/portal-core-sar/conf/hibernate/portal/domain.hbm.xml 2007-05-06
21:43:31 UTC (rev 7205)
@@ -165,7 +165,7 @@
table="JBP_WINDOW">
<key column="PK"/>
<property
- name="instanceRef"
+ name="URI"
column="INSTANCE_REF"/>
</joined-subclass>
</class>