JBoss Portal SVN: r11239 - in branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal: test/cms/commands and 1 other directory.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2008-07-01 15:59:35 -0400 (Tue, 01 Jul 2008)
New Revision: 11239
Modified:
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/StoreArchiveCommand.java
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/test/cms/commands/TestFileArchiveUpload.java
Log:
JBPORTAL-2002 - VersionException thrown when you try to upload an archive (ZIP) that contains files that already exists in the repository
Modified: branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/StoreArchiveCommand.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/StoreArchiveCommand.java 2008-07-01 19:55:44 UTC (rev 11238)
+++ branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/StoreArchiveCommand.java 2008-07-01 19:59:35 UTC (rev 11239)
@@ -113,25 +113,23 @@
content.setBasePath(sBasePath + "/" + this.msLanguage);
content.setBytes(zipBytes);
file.setContent(new Locale(this.msLanguage), content);
-
- // in case folder does not exist, yet.
- String sParentPath = NodeUtil.getParentPath(sBasePath);
- JCRCommand nodeExists = (JCRCommand)context.getCommandFactory().createItemExistsCommand(sParentPath);
+
+ //Store the file
+ JCRCommand nodeExists = (JCRCommand)context.getCommandFactory().createItemExistsCommand(file.getBasePath());
Boolean bExists = (Boolean)context.execute(nodeExists);
if (!bExists.booleanValue())
{
- this.createParentHierarchy(sParentPath);
+ //Create new file
+ JCRCommand newFile = (JCRCommand)context.getCommandFactory().createNewFileCommand(file, content);
+ context.execute(newFile);
}
-
- JCRCommand fileSave = (JCRCommand)context.getCommandFactory().createFileSaveCommand(file);
- context.execute(fileSave);
-
- JCRCommand saveContentCMD = (JCRCommand)context.getCommandFactory().createContentSaveCommand(file);
- context.execute(saveContentCMD);
-
- //Add this content to the repository
- JCRCommand createContent = (JCRCommand)context.getCommandFactory().createContentCreateNewVersionCommand(content, true);
- context.execute(createContent);
+ else
+ {
+ //Update the existing one, and make the new version created
+ //in return as live
+ JCRCommand updateFile = (JCRCommand)context.getCommandFactory().createUpdateFileCommand(file, content, true);
+ context.execute(updateFile);
+ }
}
else // isDirectory
{
Modified: branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/test/cms/commands/TestFileArchiveUpload.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/test/cms/commands/TestFileArchiveUpload.java 2008-07-01 19:55:44 UTC (rev 11238)
+++ branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/test/cms/commands/TestFileArchiveUpload.java 2008-07-01 19:59:35 UTC (rev 11239)
@@ -26,6 +26,7 @@
import org.jboss.portal.cms.CMSException;
import org.jboss.portal.cms.Command;
import org.jboss.portal.cms.model.Folder;
+import org.jboss.portal.cms.model.File;
import org.jboss.portal.common.io.IOTools;
import java.io.FileInputStream;
@@ -77,13 +78,76 @@
public void testArchiveUpload() throws CMSException, IOException
{
+ //create archive
+ this.runArchive();
+ this.assertArchiveUploadCreate();
+
+ //update archive
+ this.runArchive();
+ this.assertArchiveUploadUpdate();
+
+ }
+
+ private void runArchive() throws IOException
+ {
service.setDefaultLocale(Locale.ENGLISH.getLanguage());
- InputStream is = IOTools.safeBufferedWrapper(new FileInputStream(sZipFile));
- Command storearchiveCMD = service.getCommandFactory().createStoreArchiveCommand("", is, "en");
- service.execute(storearchiveCMD);
- is.close();
+ InputStream is = null;
+ try
+ {
+ is = IOTools.safeBufferedWrapper(new FileInputStream(sZipFile));
+ Command storearchiveCMD = service.getCommandFactory().createStoreArchiveCommand("", is, "en");
+ service.execute(storearchiveCMD);
+ }
+ finally
+ {
+ if(is != null)
+ {
+ is.close();
+ }
+ }
+ }
+
+ private void assertArchiveUploadCreate()
+ {
+ //retrieve list
+ Command listCMD = service.getCommandFactory().createFolderGetListCommand("/ziptest/poop");
+ Folder whopper = (Folder)service.execute(listCMD);
+ List folders = whopper.getFolders();
+ List files = whopper.getFiles();
+ assertEquals("Folder Size incorrect", folders.size(), 1);
+ assertEquals("File Size incorrect", files.size(), 1);
// retrieve list
+ Command listCMD2 = service.getCommandFactory().createFolderGetListCommand("/ziptest/poop/music");
+ Folder whopper2 = (Folder)service.execute(listCMD2);
+ List folders2 = whopper2.getFolders();
+ List files2 = whopper2.getFiles();
+ assertEquals("Folder Size incorrect", folders2.size(), 0);
+ assertEquals("File Size incorrect", files2.size(), 1);
+
+ //Look for single versions of files
+ for(int i=0; i<files.size(); i++)
+ {
+ File file = (File)files.get(i);
+
+ Command versionsCMD = service.getCommandFactory().createContentGetVersionsCommand(file.getBasePath()+"/en");
+ List versions = (List)service.execute(versionsCMD);
+ assertEquals("Multiple Versions not Found", versions.size(), 1);
+ }
+
+ for(int i=0; i<files2.size(); i++)
+ {
+ File file = (File)files2.get(i);
+
+ Command versionsCMD = service.getCommandFactory().createContentGetVersionsCommand(file.getBasePath()+"/en");
+ List versions = (List)service.execute(versionsCMD);
+ assertEquals("Multiple Versions not Found", versions.size(), 1);
+ }
+ }
+
+ private void assertArchiveUploadUpdate()
+ {
+ //retrieve list
Command listCMD = service.getCommandFactory().createFolderGetListCommand("/ziptest/poop");
Folder whopper = (Folder)service.execute(listCMD);
List folders = whopper.getFolders();
@@ -98,11 +162,24 @@
List files2 = whopper2.getFiles();
assertEquals("Folder Size incorrect", folders2.size(), 0);
assertEquals("File Size incorrect", files2.size(), 1);
-
- // retrieve list
- Command listCMD3 = service.getCommandFactory().createFolderGetListCommand("/");
- Folder whopper3 = (Folder)service.execute(listCMD3);
- List folders3 = whopper3.getFolders();
- List files3 = whopper3.getFiles();
+
+ //Look for multiple versions of files
+ for(int i=0; i<files.size(); i++)
+ {
+ File file = (File)files.get(i);
+
+ Command versionsCMD = service.getCommandFactory().createContentGetVersionsCommand(file.getBasePath()+"/en");
+ List versions = (List)service.execute(versionsCMD);
+ assertEquals("Multiple Versions not Found", versions.size(), 2);
+ }
+
+ for(int i=0; i<files2.size(); i++)
+ {
+ File file = (File)files2.get(i);
+
+ Command versionsCMD = service.getCommandFactory().createContentGetVersionsCommand(file.getBasePath()+"/en");
+ List versions = (List)service.execute(versionsCMD);
+ assertEquals("Multiple Versions not Found", versions.size(), 2);
+ }
}
}
16 years
JBoss Portal SVN: r11238 - branches/JBoss_Portal_Branch_2_7/core-cms/src/resources/portal-cms-sar/META-INF.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-07-01 15:55:44 -0400 (Tue, 01 Jul 2008)
New Revision: 11238
Modified:
branches/JBoss_Portal_Branch_2_7/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml
Log:
Don't use workflow by default
Modified: branches/JBoss_Portal_Branch_2_7/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml 2008-07-01 19:54:08 UTC (rev 11237)
+++ branches/JBoss_Portal_Branch_2_7/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml 2008-07-01 19:55:44 UTC (rev 11238)
@@ -62,10 +62,10 @@
<depends>portal:service=Hibernate,type=CMS</depends>
<depends>cms.pm.cache:service=TreeCache</depends>
<depends optional-attribute-name="AuthorizationManager" proxy-type="attribute">portal:service=AuthorizationManager,type=cms</depends>
-
<!-- Add this to activate publish/approval workflow integration -->
+ <!--
<depends optional-attribute-name="ApprovePublishWorkflow" proxy-type="attribute">portal:service=ApprovePublish,type=Workflow</depends>
-
+ -->
<depends optional-attribute-name="StackFactory" proxy-type="attribute">portal:service=InterceptorStackFactory,type=Cms</depends>
<attribute name="DoChecking">true</attribute>
<attribute name="DefaultContentLocation">portal/cms/conf/default-content/default/</attribute>
16 years
JBoss Portal SVN: r11237 - branches/JBoss_Portal_Branch_2_7/core-identity/src/resources/portal-identity-sar/conf.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-07-01 15:54:08 -0400 (Tue, 01 Jul 2008)
New Revision: 11237
Modified:
branches/JBoss_Portal_Branch_2_7/core-identity/src/resources/portal-identity-sar/conf/identity-ui-configuration.xml
Log:
Used automatic subscription as default
Modified: branches/JBoss_Portal_Branch_2_7/core-identity/src/resources/portal-identity-sar/conf/identity-ui-configuration.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-identity/src/resources/portal-identity-sar/conf/identity-ui-configuration.xml 2008-07-01 19:53:10 UTC (rev 11236)
+++ branches/JBoss_Portal_Branch_2_7/core-identity/src/resources/portal-identity-sar/conf/identity-ui-configuration.xml 2008-07-01 19:54:08 UTC (rev 11237)
@@ -30,7 +30,7 @@
- jbp_identity_validation_workflow: Email verification, No admin approval
- jbp_identity_validation_approval_workflow: Email verification, Admin approval
-->
- <subscription-mode>jbp_identity_validation_approval_workflow</subscription-mode>
+ <subscription-mode>automatic</subscription-mode>
<!--
overwrite-workflow: overwrites existing process definitions
-->
16 years
JBoss Portal SVN: r11236 - in branches/JBoss_Portal_Branch_2_7/workflow/src: resources/portal-workflow-sar/META-INF and 1 other directory.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-07-01 15:53:10 -0400 (Tue, 01 Jul 2008)
New Revision: 11236
Modified:
branches/JBoss_Portal_Branch_2_7/workflow/src/main/org/jboss/portal/workflow/service/JbpmThreadService.java
branches/JBoss_Portal_Branch_2_7/workflow/src/main/org/jboss/portal/workflow/service/JbpmThreadServiceMBean.java
branches/JBoss_Portal_Branch_2_7/workflow/src/resources/portal-workflow-sar/META-INF/jboss-service.xml
Log:
Tested scheduler service, cleaned up unused stuff
Modified: branches/JBoss_Portal_Branch_2_7/workflow/src/main/org/jboss/portal/workflow/service/JbpmThreadService.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/workflow/src/main/org/jboss/portal/workflow/service/JbpmThreadService.java 2008-07-01 17:53:31 UTC (rev 11235)
+++ branches/JBoss_Portal_Branch_2_7/workflow/src/main/org/jboss/portal/workflow/service/JbpmThreadService.java 2008-07-01 19:53:10 UTC (rev 11236)
@@ -23,10 +23,6 @@
package org.jboss.portal.workflow.service;
import org.jbpm.JbpmConfiguration;
-/*
-import org.jbpm.msg.command.CommandExecutorThread;
-import org.jbpm.scheduler.impl.SchedulerThread;
-*/
/**
* @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
@@ -35,31 +31,12 @@
public class JbpmThreadService implements JbpmThreadServiceMBean
{
- private int schedulerInterval = 5000;
-
- private int priority = 1;
-
private WorkflowService workflowService = null;
- /*private CommandExecutorThread commandExecutorThread = null;
-
- private SchedulerThread schedulerThread = null;*/
-
public void start()
{
JbpmConfiguration jbpmConfiguration = workflowService.getJbpmConfiguration();
-
jbpmConfiguration.getJobExecutor().start();
-
-/*
- commandExecutorThread = new CommandExecutorThread(jbpmConfiguration);
- commandExecutorThread.setPriority(priority);
- commandExecutorThread.start();
-
- schedulerThread = new SchedulerThread(jbpmConfiguration);
- schedulerThread.setPriority(priority);
- schedulerThread.setInterval(schedulerInterval);
- schedulerThread.start();*/
}
public void stop()
@@ -67,26 +44,6 @@
workflowService.getJbpmConfiguration().getJobExecutor().stop();
}
- public int getSchedulerInterval()
- {
- return schedulerInterval;
- }
-
- public void setSchedulerInterval(int schedulerInterval)
- {
- this.schedulerInterval = schedulerInterval;
- }
-
- public int getPriority()
- {
- return priority;
- }
-
- public void setPriority(int priority)
- {
- this.priority = priority;
- }
-
public WorkflowService getWorkflowService()
{
return workflowService;
Modified: branches/JBoss_Portal_Branch_2_7/workflow/src/main/org/jboss/portal/workflow/service/JbpmThreadServiceMBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/workflow/src/main/org/jboss/portal/workflow/service/JbpmThreadServiceMBean.java 2008-07-01 17:53:31 UTC (rev 11235)
+++ branches/JBoss_Portal_Branch_2_7/workflow/src/main/org/jboss/portal/workflow/service/JbpmThreadServiceMBean.java 2008-07-01 19:53:10 UTC (rev 11236)
@@ -36,13 +36,5 @@
public WorkflowService getWorkflowService();
public void setWorkflowService(WorkflowService workflowService);
-
- public int getSchedulerInterval();
-
- public void setSchedulerInterval(int schedulerInterval);
-
- public int getPriority();
-
- public void setPriority(int priority);
}
Modified: branches/JBoss_Portal_Branch_2_7/workflow/src/resources/portal-workflow-sar/META-INF/jboss-service.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/workflow/src/resources/portal-workflow-sar/META-INF/jboss-service.xml 2008-07-01 17:53:31 UTC (rev 11235)
+++ branches/JBoss_Portal_Branch_2_7/workflow/src/resources/portal-workflow-sar/META-INF/jboss-service.xml 2008-07-01 19:53:10 UTC (rev 11236)
@@ -34,15 +34,12 @@
<attribute name="JNDIName">java:/portal/workflow/WorkFlowSessionFactory</attribute>
</mbean>
-<!--
<mbean code="org.jboss.portal.workflow.service.JbpmThreadService"
name="portal:service=Thread,type=WorkflowService">
<depends optional-attribute-name="WorkflowService" proxy-type="attribute">
portal:service=Workflow,type=WorkflowService
</depends>
- <attribute name="SchedulerInterval">60000</attribute>
</mbean>
- -->
<!-- Workflow service -->
<mbean code="org.jboss.portal.workflow.service.WorkflowServiceImpl"
16 years
JBoss Portal SVN: r11235 - in branches/JBoss_Portal_Branch_2_6: cms/src/main/org/jboss/portal/cms/impl/jcr/command and 4 other directories.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2008-07-01 13:53:31 -0400 (Tue, 01 Jul 2008)
New Revision: 11235
Added:
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/util/ResourceUtil.java
Modified:
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/CMSObjectImpl.java
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/FileCreateCommand.java
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/FolderCreateCommand.java
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/test/cms/commands/TestFileCreate.java
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/test/cms/commands/TestFolderCreate.java
branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java
branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/folderlist.jsp
Log:
JBPORTAL-2031 - Create CMS content which contains a slash '/' fails
Modified: branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/CMSObjectImpl.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/CMSObjectImpl.java 2008-07-01 16:10:41 UTC (rev 11234)
+++ branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/CMSObjectImpl.java 2008-07-01 17:53:31 UTC (rev 11235)
@@ -23,6 +23,7 @@
package org.jboss.portal.cms.impl;
import org.jboss.portal.cms.model.CMSObject;
+import org.jboss.portal.cms.util.FileUtil;
import java.io.Serializable;
import java.util.Date;
@@ -87,12 +88,12 @@
public String getBasePath()
{
- return basePath;
+ return FileUtil.cleanDoubleSlashes(basePath);
}
public void setBasePath(String basePath)
- {
- this.basePath = basePath;
+ {
+ this.basePath = FileUtil.cleanDoubleSlashes(basePath);
}
public String getBaseUUID()
Modified: branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/FileCreateCommand.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/FileCreateCommand.java 2008-07-01 16:10:41 UTC (rev 11234)
+++ branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/FileCreateCommand.java 2008-07-01 17:53:31 UTC (rev 11235)
@@ -22,10 +22,14 @@
******************************************************************************/
package org.jboss.portal.cms.impl.jcr.command;
+import org.apache.log4j.Logger;
+
import org.apache.jackrabbit.value.DateValue;
+import org.jboss.portal.cms.CMSException;
import org.jboss.portal.cms.impl.jcr.JCRCommand;
import org.jboss.portal.cms.model.File;
import org.jboss.portal.cms.util.NodeUtil;
+import org.jboss.portal.cms.impl.jcr.util.ResourceUtil;
import javax.jcr.Node;
import java.util.Calendar;
@@ -38,6 +42,8 @@
{
/** The serialVersionUID */
private static final long serialVersionUID = -653823238247348749L;
+ private static Logger log = Logger.getLogger(FileCreateCommand.class);
+
File mFile;
public FileCreateCommand(File file)
@@ -49,28 +55,37 @@
{
try
{
+ //Validate the FilePath
+ boolean isValid = NodeUtil.isValidPath(mFile.getBasePath());
+ if(!isValid)
+ {
+ throw new CMSException("Path: "+mFile.getBasePath()+" is invalid");
+ }
+
JCRCommand existsCMD = (JCRCommand)context.getCommandFactory().createItemExistsCommand(mFile.getBasePath());
Boolean bExists = (Boolean)context.execute(existsCMD);
- if (!bExists.booleanValue()) // if fileNode exists already, ignore the creation.
+
+ //If fileNode exists already, ignore the creation.
+ if (!bExists.booleanValue())
{
String parentPath = NodeUtil.getParentPath(mFile.getBasePath());
String nodeName = NodeUtil.getNodeName(mFile.getBasePath());
-
+
+ //Make sure the Path hierarchy is complete
+ ResourceUtil.createParentHierarchy(context, parentPath);
+
Node parentNode = (Node)context.getSession().getItem(parentPath);
Node fileNode = parentNode.addNode(nodeName, "portalcms:file");
parentNode.setProperty("jcr:lastModified", new DateValue(Calendar.getInstance()));
parentNode.setProperty("portalcms:lastmodified", new DateValue(Calendar.getInstance()));
fileNode.setProperty("jcr:lastModified", new DateValue(Calendar.getInstance()));
parentNode.save();
- }
- else
- {
- // TODO: Do something !
- }
+ }
}
catch (Exception e)
{
- e.printStackTrace();
+ log.error(this, e);
+ throw new CMSException(e);
}
return null;
}
Modified: branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/FolderCreateCommand.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/FolderCreateCommand.java 2008-07-01 16:10:41 UTC (rev 11234)
+++ branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/FolderCreateCommand.java 2008-07-01 17:53:31 UTC (rev 11235)
@@ -22,9 +22,13 @@
******************************************************************************/
package org.jboss.portal.cms.impl.jcr.command;
+import org.apache.log4j.Logger;
import org.apache.jackrabbit.value.DateValue;
import org.apache.jackrabbit.value.StringValue;
+
+import org.jboss.portal.cms.CMSException;
import org.jboss.portal.cms.impl.jcr.JCRCommand;
+import org.jboss.portal.cms.impl.jcr.util.ResourceUtil;
import org.jboss.portal.cms.model.Folder;
import org.jboss.portal.cms.util.NodeUtil;
@@ -40,6 +44,8 @@
{
/** The serialVersionUID */
private static final long serialVersionUID = -3007711915681479942L;
+ private static Logger log = Logger.getLogger(FolderCreateCommand.class);
+
Folder mFolder;
public FolderCreateCommand(Folder folder)
@@ -51,8 +57,18 @@
{
try
{
+ //Validate the FolderPath
+ boolean isValid = NodeUtil.isValidPath(mFolder.getBasePath());
+ if(!isValid)
+ {
+ throw new CMSException("Path: "+mFolder.getBasePath()+" is invalid");
+ }
+
String parentPath = NodeUtil.getParentPath(mFolder.getBasePath());
String nodeName = NodeUtil.getNodeName(mFolder.getBasePath());
+
+ //Make sure the Path hierarchy is complete
+ ResourceUtil.createParentHierarchy(context, parentPath);
Node parentNode = (Node)context.getSession().getItem(parentPath);
Node folderNode = parentNode.addNode(nodeName, "portalcms:folder");
@@ -71,7 +87,8 @@
}
catch (Exception e)
{
- e.printStackTrace();
+ log.error(this, e);
+ throw new CMSException(e);
}
return null;
}
Added: branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/util/ResourceUtil.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/util/ResourceUtil.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/util/ResourceUtil.java 2008-07-01 17:53:31 UTC (rev 11235)
@@ -0,0 +1,121 @@
+/******************************************************************************
+ * 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.cms.impl.jcr.util;
+
+import java.util.Calendar;
+import java.util.StringTokenizer;
+import java.util.Date;
+
+import javax.jcr.Node;
+
+import org.apache.jackrabbit.value.DateValue;
+import org.apache.jackrabbit.value.StringValue;
+import org.jboss.portal.cms.CMSException;
+import org.jboss.portal.cms.model.Folder;
+import org.jboss.portal.cms.util.NodeUtil;
+import org.jboss.portal.cms.impl.jcr.JCRCommand;
+import org.jboss.portal.cms.impl.jcr.JCRCommandContext;
+import org.jboss.portal.cms.impl.FolderImpl;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class ResourceUtil
+{
+ /** @param parentPath */
+ public static void createParentHierarchy(JCRCommandContext context, String parentPath) throws CMSException
+ {
+ try
+ {
+ StringTokenizer tokenizer = new StringTokenizer(parentPath, "/");
+
+ StringBuffer buffer = new StringBuffer("/");
+ while (tokenizer.hasMoreTokens())
+ {
+ buffer.append(tokenizer.nextToken());
+ String cour = buffer.toString();
+
+ JCRCommand nodeExists = (JCRCommand)context.getCommandFactory().createItemExistsCommand(cour);
+ Boolean bExists = (Boolean)context.execute(nodeExists);
+ if (!bExists.booleanValue())
+ {
+ ResourceUtil.createFolder(context, cour);
+ }
+ else
+ {
+ //Make Sure this resource is not a file. You don't want to create a Folder inside a File
+ Node node = (Node)context.getSession().getItem(cour);
+ if(NodeTypeUtil.isFile(node))
+ {
+ throw new CMSException("Invalid Path: "+ parentPath + " : Trying to create a Folder inside a File");
+ }
+ }
+
+ if (tokenizer.hasMoreTokens())
+ {
+ buffer.append("/");
+ }
+ }
+ }
+ catch(Exception e)
+ {
+ throw new CMSException(e);
+ }
+ }
+
+ /**
+ * @param folderPath
+ * @throws CMSException
+ */
+ private static void createFolder(JCRCommandContext context, String folderPath) throws CMSException
+ {
+ try
+ {
+ Folder folder = new FolderImpl();
+ folder.setName(folderPath);
+ folder.setDescription(folderPath);
+ folder.setTitle(folderPath);
+ folder.setLastModified(new Date());
+ folder.setBasePath(folderPath);
+
+ String parentPath = NodeUtil.getParentPath(folder.getBasePath());
+ String nodeName = NodeUtil.getNodeName(folder.getBasePath());
+
+ Node parentNode = (Node)context.getSession().getItem(parentPath);
+ Node folderNode = parentNode.addNode(nodeName, "portalcms:folder");
+ folderNode.setProperty("portalcms:description", new StringValue(folder.getDescription()));
+
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(folder.getLastModified());
+ DateValue dv = new DateValue(calendar);
+ parentNode.setProperty("portalcms:lastmodified", dv);
+ folderNode.setProperty("portalcms:lastmodified", dv);
+ parentNode.save();
+ }
+ catch(Exception e)
+ {
+ throw new CMSException(e);
+ }
+ }
+}
Modified: branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/test/cms/commands/TestFileCreate.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/test/cms/commands/TestFileCreate.java 2008-07-01 16:10:41 UTC (rev 11234)
+++ branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/test/cms/commands/TestFileCreate.java 2008-07-01 17:53:31 UTC (rev 11235)
@@ -23,6 +23,8 @@
package org.jboss.portal.test.cms.commands;
import junit.framework.TestSuite;
+
+import org.jboss.portal.cms.CMSException;
import org.jboss.portal.cms.Command;
import org.jboss.portal.cms.impl.ContentImpl;
import org.jboss.portal.cms.impl.FileImpl;
@@ -149,4 +151,73 @@
session.logout();
}
+
+
+ public void testRootFileCreate() throws Exception
+ {
+ try
+ {
+ this.fileCreate("/");
+ }
+ catch(CMSException e)
+ {
+ String message = e.getMessage();
+ assertTrue("Invalid Path Not Validated", message.contains("Path: / is invalid"));
+ }
+ }
+
+ public void testRecursiveFileCreate() throws Exception
+ {
+ //Create a legal file
+ this.fileCreate("/level-1/blah");
+
+ //Assert
+ Command fileGet = service.getCommandFactory().createFileGetCommand("/level-1/blah", Locale.ENGLISH);
+ File cour = (File)service.execute(fileGet);
+ assertNotNull("File was not created", cour);
+ assertEquals("Content Incorrect", new String(cour.getContent().getBytes()), "1234567890");
+
+ //Try to create a file that should not be allowed
+ try
+ {
+ this.fileCreate("/level-1/blah/blah2");
+ }
+ catch(CMSException e)
+ {
+ String message = e.getMessage();
+ assertTrue("Invalid Parent Hierarchy Not Validated", message.contains("Trying to create a Folder inside a File"));
+ }
+
+ //Try to create a file way down the path hierarchy
+ this.fileCreate("/level-1/level-2/level-3/blah");
+
+ //Assert
+ fileGet = service.getCommandFactory().createFileGetCommand("/level-1/level-2/level-3/blah", Locale.ENGLISH);
+ cour = (File)service.execute(fileGet);
+ assertNotNull("File was not created", cour);
+ assertEquals("Content Incorrect", new String(cour.getContent().getBytes()), "1234567890");
+ }
+
+ /**
+ *
+ * @param path
+ */
+ private void fileCreate(String path)
+ {
+ //create file english
+ File file = new FileImpl();
+ file.setBasePath(path);
+
+ Content content = new ContentImpl();
+ content.setEncoding("UTF-8");
+ content.setTitle("English Title");
+ content.setDescription("English Description");
+ content.setBasePath(path + "/" + Locale.ENGLISH.getLanguage());
+ content.setBytes("1234567890".getBytes());
+ content.setMimeType("image/gif");
+ file.setContent(Locale.ENGLISH, content);
+
+ Command createFileCMD = service.getCommandFactory().createNewFileCommand(file, content);
+ service.execute(createFileCMD);
+ }
}
Modified: branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/test/cms/commands/TestFolderCreate.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/test/cms/commands/TestFolderCreate.java 2008-07-01 16:10:41 UTC (rev 11234)
+++ branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/test/cms/commands/TestFolderCreate.java 2008-07-01 17:53:31 UTC (rev 11235)
@@ -96,4 +96,45 @@
assertNotNull("Folder description is null", description);
assertTrue("Incorrect description for " + sFolderPath, description.getString().equals("Folder description"));
}
+
+ public void testRecursiveFolderCreate() throws Exception
+ {
+ this.createFolder("/level-1/blah");
+ this.assertFolder("/level-1/blah");
+
+ //Create a deeper folder
+ this.createFolder("/level-1/level-2/level-3/blah");
+ this.assertFolder("/level-1/level-2/level-3/blah");
+ }
+
+ private void createFolder(String folderPath)
+ {
+ //create folder object
+ Folder folder = new FolderImpl();
+ folder.setCreationDate(new Date());
+ folder.setDescription("Folder description");
+ folder.setTitle("Folder Title");
+ folder.setLastModified(new Date());
+ folder.setName("Alpha Folder");
+ folder.setBasePath(folderPath);
+
+ // save folder
+ Command saveCMD = service.getCommandFactory().createFolderSaveCommand(folder);
+ service.execute(saveCMD);
+ }
+
+ private void assertFolder(String folderPath) throws Exception
+ {
+ String[] cour = folderPath.split("/");
+ String folderName = cour[cour.length-1];
+
+ Session session = RepositoryUtil.login(service.getRepository(), "anonid", "");
+ Node folderNode = (Node)session.getItem(folderPath);
+ assertNotNull("FolderNodeis null", folderNode);
+ assertTrue("Incorrect primarynodetype", folderNode.getPrimaryNodeType().getName().equals("portalcms:folder"));
+ assertTrue("Incorrect Name for " + sFolderPath, folderNode.getName().equals(folderName));
+ Property description = folderNode.getProperty("portalcms:description");
+ assertNotNull("Folder description is null", description);
+ assertTrue("Incorrect description for " + sFolderPath, description.getString().equals("Folder description"));
+ }
}
Modified: branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java 2008-07-01 16:10:41 UTC (rev 11234)
+++ branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java 2008-07-01 17:53:31 UTC (rev 11235)
@@ -259,7 +259,7 @@
List folders = this.getFolderList(sNavPath);
if((folders == null || folders.isEmpty()) &&
- !sNavPath.equals("/"))
+ (sNavPath != null && !sNavPath.equals("/")))
{
sNavPath = NodeUtil.getParentPath(sNavPath);
folders = this.getFolderList(sNavPath);
@@ -289,7 +289,7 @@
List folders = this.getFolderList(sNavPath);
if((folders == null || folders.isEmpty()) &&
- !sNavPath.equals("/"))
+ (sNavPath != null && !sNavPath.equals("/")))
{
sNavPath = NodeUtil.getParentPath(sNavPath);
folders = this.getFolderList(sNavPath);
@@ -397,7 +397,7 @@
List folders = this.getFolderList(sNavPath);
if((folders == null || folders.isEmpty()) &&
- !sNavPath.equals("/"))
+ (sNavPath != null && !sNavPath.equals("/")))
{
sNavPath = NodeUtil.getParentPath(sNavPath);
folders = this.getFolderList(sNavPath);
@@ -425,7 +425,7 @@
List folders = this.getFolderList(sNavPath);
if((folders == null || folders.isEmpty()) &&
- !sNavPath.equals("/"))
+ (sNavPath != null && !sNavPath.equals("/")))
{
sNavPath = NodeUtil.getParentPath(sNavPath);
folders = this.getFolderList(sNavPath);
@@ -454,7 +454,7 @@
List folders = this.getFolderList(sNavPath);
if((folders == null || folders.isEmpty()) &&
- !sNavPath.equals("/"))
+ (sNavPath != null && !sNavPath.equals("/")))
{
sNavPath = NodeUtil.getParentPath(sNavPath);
folders = this.getFolderList(sNavPath);
@@ -610,7 +610,7 @@
List folders = this.getFolderList(sNavPath);
if((folders == null || folders.isEmpty()) &&
- !sNavPath.equals("/"))
+ (sNavPath != null && !sNavPath.equals("/")))
{
sNavPath = NodeUtil.getParentPath(sNavPath);
folders = this.getFolderList(sNavPath);
Modified: branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/folderlist.jsp
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/folderlist.jsp 2008-07-01 16:10:41 UTC (rev 11234)
+++ branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/folderlist.jsp 2008-07-01 17:53:31 UTC (rev 11235)
@@ -103,25 +103,5 @@
folder.getBasePath().substring(folder.getBasePath().lastIndexOf("/") + 1, folder.getBasePath().length()) %></a>
<br>
-<%
- }
-}
-else
-{
-%>
-<a href="<portlet:renderURL>
- <portlet:param name="op" value="<%= OP %>"/>
- <portlet:param name="path" value="<%= sCurrPath %>"/>
- <portlet:param name="navpath" value="<%= NodeUtil.getParentPath(sNavPath) %>"/>
- <%
- if(sCMType != null)
- {
- %>
- <portlet:param name="type" value="<%= sCMType %>"/>
- <%
- }
- %>
-</portlet:renderURL>">Up</a>
-<%
- }
-%>
+<%}
+}%>
16 years
JBoss Portal SVN: r11234 - in branches/JBoss_Portal_Branch_2_7/core-samples/src/bin: portal-catalog-samples-war and 1 other directories.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-07-01 12:10:41 -0400 (Tue, 01 Jul 2008)
New Revision: 11234
Added:
branches/JBoss_Portal_Branch_2_7/core-samples/src/bin/portal-catalog-samples-war/
branches/JBoss_Portal_Branch_2_7/core-samples/src/bin/portal-catalog-samples-war/images/
branches/JBoss_Portal_Branch_2_7/core-samples/src/bin/portal-catalog-samples-war/images/T.gif
branches/JBoss_Portal_Branch_2_7/core-samples/src/bin/portal-catalog-samples-war/images/bullet.gif
Log:
Missing from previous commit
Added: branches/JBoss_Portal_Branch_2_7/core-samples/src/bin/portal-catalog-samples-war/images/T.gif
===================================================================
(Binary files differ)
Property changes on: branches/JBoss_Portal_Branch_2_7/core-samples/src/bin/portal-catalog-samples-war/images/T.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/JBoss_Portal_Branch_2_7/core-samples/src/bin/portal-catalog-samples-war/images/bullet.gif
===================================================================
(Binary files differ)
Property changes on: branches/JBoss_Portal_Branch_2_7/core-samples/src/bin/portal-catalog-samples-war/images/bullet.gif
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
16 years
JBoss Portal SVN: r11233 - in branches/JBoss_Portal_Branch_2_7: core/src/bin/portal-core-war/images and 8 other directories.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-07-01 12:05:22 -0400 (Tue, 01 Jul 2008)
New Revision: 11233
Removed:
branches/JBoss_Portal_Branch_2_7/core/src/bin/portal-core-war/images/catalog/
branches/JBoss_Portal_Branch_2_7/core/src/bin/portal-core-war/images/main-bg.jpg
branches/JBoss_Portal_Branch_2_7/core/src/bin/portal-core-war/images/portletIcon_Users.gif
branches/JBoss_Portal_Branch_2_7/core/src/bin/portal-core-war/images/role/
branches/JBoss_Portal_Branch_2_7/core/src/bin/portal-core-war/images/user/
branches/JBoss_Portal_Branch_2_7/core/src/bin/portal-core-war/login/
branches/JBoss_Portal_Branch_2_7/core/src/bin/portal-core-war/nodesk/
branches/JBoss_Portal_Branch_2_7/core/src/bin/portal-core-war/phalanx/
branches/JBoss_Portal_Branch_2_7/core/src/bin/portal-core-war/themes/mission-critical/
branches/JBoss_Portal_Branch_2_7/core/src/bin/portal-core-war/themes/phalanx/
Modified:
branches/JBoss_Portal_Branch_2_7/core-cms/src/bin/portal-cms-sar/portal/cms/conf/default-content/default/index.html
branches/JBoss_Portal_Branch_2_7/core-samples/build.xml
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/default-object.xml
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/jsp/catalog/index.jsp
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/jsp/catalog/sitemap.jsp
branches/JBoss_Portal_Branch_2_7/core/src/bin/portal-core-war/themes/industrial/portal_style.css
branches/JBoss_Portal_Branch_2_7/core/src/bin/portal-core-war/themes/maple/portal_style.css
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB-INF/portal-layouts.xml
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB-INF/portal-themes.xml
Log:
- Did some cleanup
- Removed 2 broken themes
- 'Fixed' 2 broken themes
- Move 'catalog' related images to samples
Deleted: branches/JBoss_Portal_Branch_2_7/core/src/bin/portal-core-war/images/main-bg.jpg
===================================================================
(Binary files differ)
Deleted: branches/JBoss_Portal_Branch_2_7/core/src/bin/portal-core-war/images/portletIcon_Users.gif
===================================================================
(Binary files differ)
Modified: branches/JBoss_Portal_Branch_2_7/core/src/bin/portal-core-war/themes/industrial/portal_style.css
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/bin/portal-core-war/themes/industrial/portal_style.css 2008-07-01 15:24:31 UTC (rev 11232)
+++ branches/JBoss_Portal_Branch_2_7/core/src/bin/portal-core-war/themes/industrial/portal_style.css 2008-07-01 16:05:22 UTC (rev 11233)
@@ -232,16 +232,23 @@
* Tab Navigation for Header *
*****************************/
-UL#tabsHeader {
+div#navigation {
+ position:relative;
+ width: 100%;
+ height: 64px;
+}
+
+ul#tabsHeader {
+ width: 100%;
+ list-style: none;
margin: 0;
- padding-left: 300px;
+ padding-left: 0px;
min-width: 550px;
- z-index: 100; /* added for submenu hover */
- position: relative; /* added for submenu hover */
+ z-index: 1; /* added for submenu hover */
+ position: absolute; /* added for submenu hover */
}
-UL#tabsHeader li {
- list-style: none;
+ul#tabsHeader li {
float: left;
margin-left: -1px;
margin-top: 74px;
@@ -250,11 +257,13 @@
padding: 0px;
border-right: 1px solid #72828E;
border-left: 1px solid #72828E;
+ position:relative;
}
-UL#tabsHeader li:hover {
- background-image: url( images/highlightedTab.gif );
- background-repeat: repeat-x;
+UL#tabsHeader li,
+ul#tabsHeader li#current {
+ background-position:top right;
+ background-repeat: no-repeat;
}
/* hover selectors for main header tabs done to deal
@@ -293,7 +302,7 @@
/* Begin Submenu selectors */
/* hide the sub levels and give them a positon absolute so that they take up no room */
-UL#tabsHeader ul {
+ul#tabsHeader ul {
visibility: hidden;
position: absolute;
height: 0;
@@ -303,18 +312,19 @@
text-align: left;
margin: 0px;
padding: 0px;
- margin-top: 22px;
+ margin-top: 24px;
}
-UL#tabsHeader ul a {
+ul#tabsHeader ul a {
+ text-decoration: none;
font-size: 11px;
font-family: Verdana, Arial, Helvetica, Sans-Serif, sans-serif;
font-weight: normal;
color: #5078aa;
-
+ background-image: none;
}
-UL#tabsHeader ul a:hover {
+ul#tabsHeader ul a:hover {
font-size: 11px;
font-family: Verdana, Arial, Helvetica, Sans-Serif, sans-serif;
font-weight: normal;
@@ -326,6 +336,7 @@
font-family: Verdana, Arial, Helvetica, Sans-Serif, sans-serif;
font-weight: normal;
color: #5078aa;
+ background-image: none;
}
UL#tabsHeader li:hover ul {
@@ -337,16 +348,20 @@
color: #5078aa;
padding: 3px;
width: 120px;
-
+ list-style: none;
border: 1px solid #FFFFFF;
- border-width: 1px 1px 0 0;
-
+ border-width: 0 1px 1px 1px;
+ background-image:none;
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
}
-UL#tabsHeader ul li:hover {
+ul#tabsHeader ul li#current ul li {
+ background-image: none;
+}
+
+ul#tabsHeader ul li:hover {
background: #E2E2E2;
}
@@ -389,7 +404,9 @@
*****************************/
#dashboardnav {
- float: right;
+ position:absolute;
+ top:0;
+ right: 15px;
font-size: 10px;
padding: 6px 12px 0px 0px;
color: #FFFFFF;
@@ -427,6 +444,9 @@
line-height: 100%;
float: left;
text-indent: 15px;
+ padding-top: 5px;
+ padding-bottom: 6px;
+ display: block;
}
.portlet-titlebar-decoration {
Modified: branches/JBoss_Portal_Branch_2_7/core/src/bin/portal-core-war/themes/maple/portal_style.css
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/bin/portal-core-war/themes/maple/portal_style.css 2008-07-01 15:24:31 UTC (rev 11232)
+++ branches/JBoss_Portal_Branch_2_7/core/src/bin/portal-core-war/themes/maple/portal_style.css 2008-07-01 16:05:22 UTC (rev 11233)
@@ -294,7 +294,7 @@
UL#tabsHeader #current, UL#tabsHeader #current a {
font: 13px / normal Arial, Helvetica, Sans-Serif, sans-serif;
font-weight: 500;
- color: #E4EECC;
+ color: #95A490;
line-height: 25px;
border-right: 0px;
border-left: 0px;
@@ -315,7 +315,7 @@
height: 0;
top: 0px;
left: 0;
- width: 150px;
+ width: 200px;
text-align: left;
margin: 0px;
padding: 0px;
@@ -325,23 +325,23 @@
UL#tabsHeader ul a {
font-size: 11px;
font-family: Verdana, Arial, Helvetica, Sans-Serif, sans-serif;
- font-weight: normal;
- color: #5078aa;
+ font-weight: bold;
+ color: #9F625D;
}
UL#tabsHeader ul a:hover {
font-size: 11px;
font-family: Verdana, Arial, Helvetica, Sans-Serif, sans-serif;
- font-weight: normal;
- color: #5078aa;
+ font-weight: bold;
+ color: #9F625D;
}
UL#tabsHeader #current ul a {
font-size: 11px;
font-family: Verdana, Arial, Helvetica, Sans-Serif, sans-serif;
font-weight: normal;
- color: #5078aa;
+ color: #9F625D;
}
UL#tabsHeader li:hover ul {
@@ -349,21 +349,22 @@
}
UL#tabsHeader ul li {
- background: #EDECEC;
+ background: #e4eecc;
color: #5078aa;
- padding: 3px;
- width: 120px;
+ padding: 5px;
+ width: 150px;
+ height: 18px;
+
+ border: 1px solid #95A490;
+ border-width: 0 1px 1px 1px;
- border: 1px solid #FFFFFF;
- border-width: 1px 1px 0 0;
-
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
}
UL#tabsHeader ul li:hover {
- background: #E2E2E2;
+ background: #cad6b8;
}
/* End Submenu selectors */
@@ -437,13 +438,14 @@
height: 22px;
width: 17px;
float: left;
+ margin-top: -1px;
}
/* wrapper for floating portlet window modes */
.portlet-mode-container {
float: right;
padding-left: 4px;
- padding-top: 1px;
+ padding-top: 0px;
}
.portlet-titlebar-left {
Modified: branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB-INF/portal-layouts.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB-INF/portal-layouts.xml 2008-07-01 15:24:31 UTC (rev 11232)
+++ branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB-INF/portal-layouts.xml 2008-07-01 16:05:22 UTC (rev 11233)
@@ -23,25 +23,7 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<layouts>
- <!-- layout>
- <name>nodesk</name>
- <uri>/nodesk/index.jsp</uri>
- <uri state="maximized">/nodesk/index.jsp</uri>
- <regions>
- <region name="left"/>
- <region name="center"/>
- </regions>
- </layout>
<layout>
- <name>phalanx</name>
- <uri>/phalanx/index.jsp</uri>
- <uri state="maximized">/phalanx/index.jsp</uri>
- <regions>
- <region name="left"/>
- <region name="center"/>
- </regions>
- </layout-->
- <layout>
<name>generic</name>
<uri>/layouts/generic/index.jsp</uri>
<uri state="maximized">/layouts/generic/maximized.jsp</uri>
Modified: branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB-INF/portal-themes.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB-INF/portal-themes.xml 2008-07-01 15:24:31 UTC (rev 11232)
+++ branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB-INF/portal-themes.xml 2008-07-01 16:05:22 UTC (rev 11233)
@@ -35,16 +35,6 @@
<link rel="shortcut icon" href="/themes/industrial/images/favicon.ico"/>
</theme>
<theme>
- <name>nphalanx</name>
- <link rel="stylesheet" id="main_css" href="/themes/phalanx/portal_style.css" type="text/css"/>
- <link rel="shortcut icon" href="/themes/phalanx/images/favicon.ico"/>
- </theme>
- <theme>
- <name>mission-critical</name>
- <link rel="stylesheet" id="main_css" href="/themes/mission-critical/portal_style.css" type="text/css"/>
- <link rel="shortcut icon" href="/themes/mission-critical/images/favicon.ico"/>
- </theme>
- <theme>
<name>maple</name>
<link rel="stylesheet" id="main_css" href="/themes/maple/portal_style.css" type="text/css"/>
<link rel="shortcut icon" href="/themes/maple/images/favicon.ico"/>
Modified: branches/JBoss_Portal_Branch_2_7/core-cms/src/bin/portal-cms-sar/portal/cms/conf/default-content/default/index.html
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-cms/src/bin/portal-cms-sar/portal/cms/conf/default-content/default/index.html 2008-07-01 15:24:31 UTC (rev 11232)
+++ branches/JBoss_Portal_Branch_2_7/core-cms/src/bin/portal-cms-sar/portal/cms/conf/default-content/default/index.html 2008-07-01 16:05:22 UTC (rev 11233)
@@ -1,9 +1,9 @@
<div>
- <img src="default/images/2_7-go-faster.gif" width="626" height="148" alt="JBoss Portal 2.7: Go Faster!"/>
+ <img src="default/images/2_7-go-faster.gif" width="626" height="148" style="margin:10px auto auto auto" alt="JBoss Portal 2.7: Go Faster!"/>
</div>
<br/>
<div>
- <img src="default/images/info-banner.gif" width="626" height="73" border="0" usemap="#Map" style="margin:0 0 0 7px">
+ <img src="default/images/info-banner.gif" width="626" height="73" border="0" usemap="#Map" alt="Services"/>
<map name="Map">
<area shape="rect" coords="1,1,201,72" href="/portal/content/default/support.html">
<area shape="rect" coords="201,0,439,73" href="http://www.jboss.org/index.html?module=bb&op=viewforum&f=215">
Modified: branches/JBoss_Portal_Branch_2_7/core-samples/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/build.xml 2008-07-01 15:24:31 UTC (rev 11232)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/build.xml 2008-07-01 16:05:22 UTC (rev 11233)
@@ -221,6 +221,7 @@
<!-- portal-catalog-samples.war -->
<copy todir="${build.resources}/portal-catalog-samples.war">
+ <fileset dir="${source.bin}/portal-catalog-samples-war"/>
<fileset dir="${build.resources}/portal-catalog-samples-war"/>
</copy>
<mkdir dir="${build.resources}/portal-catalog-samples.war/WEB-INF/lib/"/>
Modified: branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/default-object.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/default-object.xml 2008-07-01 15:24:31 UTC (rev 11232)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/default-object.xml 2008-07-01 16:05:22 UTC (rev 11233)
@@ -56,7 +56,7 @@
<height>0</height>
</window>
<page>
- <page-name>event test</page-name>
+ <page-name>Event test</page-name>
<listener>test_listener</listener>
<window>
<window-name>CatalogPortletWindow</window-name>
@@ -78,7 +78,7 @@
</window>
</page>
<page>
- <page-name>page event test</page-name>
+ <page-name>Page event test</page-name>
<listener>window_event_listener</listener>
<window>
<window-name>EventPortletWindow1</window-name>
@@ -118,7 +118,7 @@
</window>
</page>
<page>
- <page-name>secure test</page-name>
+ <page-name>Secure test</page-name>
<window>
<window-name>CatalogPortletWindow</window-name>
<instance-ref>CatalogPortletInstance</instance-ref>
@@ -133,7 +133,7 @@
</window>
</page>
<page>
- <page-name>exception test</page-name>
+ <page-name>Exception test</page-name>
<window>
<window-name>CatalogPortletWindow</window-name>
<instance-ref>CatalogPortletInstance</instance-ref>
@@ -148,7 +148,7 @@
</window>
</page>
<page>
- <page-name>cache test</page-name>
+ <page-name>Cache test</page-name>
<window>
<window-name>CatalogPortletWindow</window-name>
<instance-ref>CatalogPortletInstance</instance-ref>
@@ -169,7 +169,7 @@
</window>
</page>
<page>
- <page-name>session test</page-name>
+ <page-name>Session test</page-name>
<window>
<window-name>CatalogPortletWindow</window-name>
<instance-ref>CatalogPortletInstance</instance-ref>
@@ -184,7 +184,7 @@
</window>
</page>
<page>
- <page-name>missing portlet</page-name>
+ <page-name>Missing portlet</page-name>
<window>
<window-name>CatalogPortletWindow</window-name>
<instance-ref>CatalogPortletInstance</instance-ref>
@@ -220,7 +220,7 @@
</window>
</page>
<page>
- <page-name>missing instance</page-name>
+ <page-name>Missing instance</page-name>
<window>
<window-name>CatalogPortletWindow</window-name>
<instance-ref>CatalogPortletInstance</instance-ref>
@@ -235,7 +235,7 @@
</window>
</page>
<page>
- <page-name>charset test</page-name>
+ <page-name>Charset test</page-name>
<window>
<window-name>CatalogPortletWindow</window-name>
<instance-ref>CatalogPortletInstance</instance-ref>
@@ -250,7 +250,7 @@
</window>
</page>
<page>
- <page-name>encoding test</page-name>
+ <page-name>Encoding test</page-name>
<window>
<window-name>CatalogPortletWindow</window-name>
<instance-ref>CatalogPortletInstance</instance-ref>
@@ -265,7 +265,7 @@
</window>
</page>
<page>
- <page-name>header test</page-name>
+ <page-name>Header test</page-name>
<window>
<window-name>CatalogPortletWindow</window-name>
<instance-ref>CatalogPortletInstance</instance-ref>
@@ -280,7 +280,7 @@
</window>
</page>
<page>
- <page-name>javascript test</page-name>
+ <page-name>Javascript test</page-name>
<window>
<window-name>CatalogPortletWindow</window-name>
<instance-ref>CatalogPortletInstance</instance-ref>
@@ -295,7 +295,7 @@
</window>
</page>
<page>
- <page-name>mode test</page-name>
+ <page-name>Mode test</page-name>
<window>
<window-name>CatalogPortletWindow</window-name>
<instance-ref>CatalogPortletInstance</instance-ref>
@@ -310,7 +310,7 @@
</window>
</page>
<page>
- <page-name>window id test</page-name>
+ <page-name>Window id test</page-name>
<window>
<window-name>CatalogPortletWindow</window-name>
<instance-ref>CatalogPortletInstance</instance-ref>
@@ -325,7 +325,7 @@
</window>
</page>
<page>
- <page-name>public parameters test</page-name>
+ <page-name>Public parameters test</page-name>
<window>
<window-name>PublicParametersPortletWindow1</window-name>
<instance-ref>PublicParametersPortletInstance1</instance-ref>
@@ -346,7 +346,7 @@
</window>
</page>
<page>
- <page-name>file system content</page-name>
+ <page-name>File system content</page-name>
<window>
<window-name>FSWindow</window-name>
<content>
@@ -389,7 +389,7 @@
<height>0</height>
</window>
<page>
- <page-name>event test</page-name>
+ <page-name>Event test</page-name>
<listener>test_listener</listener>
<window>
<window-name>CatalogPortletWindow</window-name>
@@ -411,7 +411,7 @@
</window>
</page>
<page>
- <page-name>page event test</page-name>
+ <page-name>Page event test</page-name>
<listener>window_event_listener</listener>
<window>
<window-name>CatalogPortletWindow1</window-name>
@@ -451,7 +451,7 @@
</window>
</page>
<page>
- <page-name>secure test</page-name>
+ <page-name>Secure test</page-name>
<window>
<window-name>CatalogPortletWindow</window-name>
<instance-ref>CatalogPortletInstance</instance-ref>
@@ -466,7 +466,7 @@
</window>
</page>
<page>
- <page-name>exception test</page-name>
+ <page-name>Exception test</page-name>
<window>
<window-name>CatalogPortletWindow</window-name>
<instance-ref>CatalogPortletInstance</instance-ref>
@@ -481,7 +481,7 @@
</window>
</page>
<page>
- <page-name>cache test</page-name>
+ <page-name>Cache test</page-name>
<window>
<window-name>CatalogPortletWindow</window-name>
<instance-ref>CatalogPortletInstance</instance-ref>
@@ -502,7 +502,7 @@
</window>
</page>
<page>
- <page-name>session test</page-name>
+ <page-name>Session test</page-name>
<window>
<window-name>CatalogPortletWindow</window-name>
<instance-ref>CatalogPortletInstance</instance-ref>
@@ -517,7 +517,7 @@
</window>
</page>
<page>
- <page-name>missing portlet</page-name>
+ <page-name>Missing portlet</page-name>
<window>
<window-name>CatalogPortletWindow</window-name>
<instance-ref>CatalogPortletInstance</instance-ref>
@@ -553,7 +553,7 @@
</window>
</page>
<page>
- <page-name>missing instance</page-name>
+ <page-name>Missing instance</page-name>
<window>
<window-name>CatalogPortletWindow</window-name>
<instance-ref>CatalogPortletInstance</instance-ref>
@@ -568,7 +568,7 @@
</window>
</page>
<page>
- <page-name>charset test</page-name>
+ <page-name>Charset test</page-name>
<window>
<window-name>CatalogPortletWindow</window-name>
<instance-ref>CatalogPortletInstance</instance-ref>
@@ -583,7 +583,7 @@
</window>
</page>
<page>
- <page-name>encoding test</page-name>
+ <page-name>Encoding test</page-name>
<window>
<window-name>CatalogPortletWindow</window-name>
<instance-ref>CatalogPortletInstance</instance-ref>
@@ -598,7 +598,7 @@
</window>
</page>
<page>
- <page-name>header test</page-name>
+ <page-name>Header test</page-name>
<window>
<window-name>CatalogPortletWindow</window-name>
<instance-ref>CatalogPortletInstance</instance-ref>
@@ -613,7 +613,7 @@
</window>
</page>
<page>
- <page-name>javascript test</page-name>
+ <page-name>Javascript test</page-name>
<window>
<window-name>CatalogPortletWindow</window-name>
<instance-ref>CatalogPortletInstance</instance-ref>
@@ -628,7 +628,7 @@
</window>
</page>
<page>
- <page-name>mode test</page-name>
+ <page-name>Mode test</page-name>
<window>
<window-name>CatalogPortletWindow</window-name>
<instance-ref>CatalogPortletInstance</instance-ref>
@@ -643,7 +643,7 @@
</window>
</page>
<page>
- <page-name>window id test</page-name>
+ <page-name>Window id test</page-name>
<window>
<window-name>CatalogPortletWindow</window-name>
<instance-ref>CatalogPortletInstance</instance-ref>
@@ -658,7 +658,7 @@
</window>
</page>
<page>
- <page-name>public parameters test</page-name>
+ <page-name>Public parameters test</page-name>
<window>
<window-name>PublicParametersPortletWindow1</window-name>
<instance-ref>PublicParametersPortletInstance1</instance-ref>
Modified: branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/jsp/catalog/index.jsp
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/jsp/catalog/index.jsp 2008-07-01 15:24:31 UTC (rev 11232)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/jsp/catalog/index.jsp 2008-07-01 16:05:22 UTC (rev 11233)
@@ -21,18 +21,16 @@
list-style-position: outside;
margin-left: 20px;
vertical-align: top;
- list-style-image: url( <%= contextPath %> /images/catalog/bullet.gif );
+ list-style-image: url( <%= contextPath %>/images/bullet.gif );
}
.pagenosub {
margin-top: 5px;
margin-left: 0px;
font-weight: bold;
- list-style-image: url( <%= contextPath %> /images/catalog/bullet.gif );
+ list-style-image: url( <%= contextPath %>/images/bullet.gif );
}
- /
- /
-->
</style>
Modified: branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/jsp/catalog/sitemap.jsp
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/jsp/catalog/sitemap.jsp 2008-07-01 15:24:31 UTC (rev 11232)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/jsp/catalog/sitemap.jsp 2008-07-01 16:05:22 UTC (rev 11233)
@@ -20,7 +20,7 @@
padding: 0px 0px 0px 0px;
cursor: pointer;
cursor: hand;
- list-style-image: url( <%= contextPath %> /images/catalog/bullet.gif );
+ list-style-image: url( <%= contextPath %> /images/bullet.gif );
}
#foldinglist {
@@ -30,12 +30,12 @@
margin-left: 0px;
padding: 0px 0px 0px 0px;
vertical-align: top;
- list-style-image: url( <%= contextPath %> /images/catalog/T.gif )
+ list-style-image: url( <%= contextPath %> /images/T.gif )
}
#pagenosub {
margin-left: -10px;
- list-style-image: url( <%= contextPath %> /images/catalog/bullet.gif )
+ list-style-image: url( <%= contextPath %> /images/bullet.gif )
}
/
@@ -83,7 +83,7 @@
PortalNodeURL subchildURL = jresponse.createRenderURL(subChild);
%>
<tr>
- <td><img src="<%= contextPath %>/images/catalog/T.gif"/></td>
+ <td><img src="<%= contextPath %>/images/T.gif"/></td>
<td><a href="<%= subchildURL %>"><%= subChild.getName() %>
</a></td>
</tr>
16 years
JBoss Portal SVN: r11232 - in modules/identity/branches/JBP_IDENTITY_BRANCH_1_0: identity/src/main/org/jboss/portal/identity and 8 other directories.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2008-07-01 11:24:31 -0400 (Tue, 01 Jul 2008)
New Revision: 11232
Added:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/event/MembershipChangedEvent.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/event/RoleCreatedEvent.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/event/RoleDestroyedEvent.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/event/RoleUpdatedEvent.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/TestEventBroadcaster.java
Modified:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/build.xml
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/DelegatingUserProfileModuleImpl.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/db/HibernateMembershipModuleImpl.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/db/HibernateRoleImpl.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/db/HibernateRoleModuleImpl.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/db/HibernateUserProfileModuleImpl.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/event/UserProfileChangedEvent.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPRoleModule.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPRoleModuleImpl.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPStaticGroupMembershipModuleImpl.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPStaticRoleMembershipModuleImpl.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserProfileModuleImpl.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/service/MembershipModuleService.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/service/RoleModuleService.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/service/UserProfileModuleService.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/IdentityTest.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/TestServiceLoader.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/db/DBIdentityTestCase.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/db/DBTestCase.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPIdentityTestCase.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPTestCase.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/testsuite/build.xml
Log:
JBPORTAL-2019 - Notifications for identity
Modified: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/build.xml
===================================================================
--- modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/build.xml 2008-07-01 14:25:37 UTC (rev 11231)
+++ modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/build.xml 2008-07-01 15:24:31 UTC (rev 11232)
@@ -477,11 +477,11 @@
<x-test>
- <!--<test todir="${test.reports}" name="org.jboss.portal.test.identity.db.DBIdentityTestCase"/>
- <test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPIdentityTestCase"/>-->
+ <test todir="${test.reports}" name="org.jboss.portal.test.identity.db.DBIdentityTestCase"/>
+ <!--<test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPIdentityTestCase"/>-->
<!--<test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPSimpleUserModuleTestCase"/>-->
<!--<test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPSimpleRoleModuleTestCase"/>-->
- <test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPStaticGroupMembershipModuleTestCase"/>
+ <!--<test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPStaticGroupMembershipModuleTestCase"/>-->
<!--<test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPStaticRoleMembershipModuleTestCase"/>-->
<!--<test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPUserProfileModuleTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.identity.ldap.LDAPExtUserModuleTestCase"/>
Modified: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/DelegatingUserProfileModuleImpl.java
===================================================================
--- modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/DelegatingUserProfileModuleImpl.java 2008-07-01 14:25:37 UTC (rev 11231)
+++ modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/DelegatingUserProfileModuleImpl.java 2008-07-01 15:24:31 UTC (rev 11232)
@@ -134,7 +134,7 @@
log.debug("Delegating to DB module");
getDBModule().setProperty(user, name, propertyValue);
- fireUserProfileChangedEvent(user.getId(), user.getUserName(), name);
+ fireUserProfileChangedEvent(user.getId(), user.getUserName(), name, propertyValue);
return;
}
throw new IdentityException("Cannot process property - incorrect profile or module configuration");
Modified: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/db/HibernateMembershipModuleImpl.java
===================================================================
--- modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/db/HibernateMembershipModuleImpl.java 2008-07-01 14:25:37 UTC (rev 11231)
+++ modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/db/HibernateMembershipModuleImpl.java 2008-07-01 15:24:31 UTC (rev 11232)
@@ -179,6 +179,8 @@
}
}
+ fireMembershipChangedEvent(role, users);
+
}
public void assignRoles(User user, Set roles) throws IdentityException
@@ -224,6 +226,8 @@
// Assign new roles
HibernateUserImpl ui = (HibernateUserImpl)user;
ui.setRoles(copy);
+
+ fireMembershipChangedEvent(user, roles);
}
//TODO:
Modified: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/db/HibernateRoleImpl.java
===================================================================
--- modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/db/HibernateRoleImpl.java 2008-07-01 14:25:37 UTC (rev 11231)
+++ modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/db/HibernateRoleImpl.java 2008-07-01 15:24:31 UTC (rev 11232)
@@ -22,7 +22,17 @@
package org.jboss.portal.identity.db;
import org.jboss.portal.identity.Role;
+import org.jboss.portal.identity.IdentityServiceController;
+import org.jboss.portal.identity.IdentityContext;
+import org.jboss.portal.identity.event.IdentityEventBroadcaster;
+import org.jboss.portal.identity.event.RoleUpdatedEvent;
+import org.jboss.mx.util.MBeanServerLocator;
+import org.jboss.mx.util.MBeanProxy;
+import org.jboss.mx.util.MBeanProxyCreationException;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import javax.management.MalformedObjectNameException;
import java.util.Set;
import java.util.HashSet;
@@ -37,10 +47,14 @@
implements Role
{
+ /** . */
+ private static final org.jboss.logging.Logger log = org.jboss.logging.Logger.getLogger(HibernateRoleImpl.class);
+
private Long key;
private String name;
private Set users;
private String displayName;
+ private IdentityEventBroadcaster eventBroadcaster;
/**
*
@@ -132,6 +146,14 @@
public void setDisplayName(String displayName)
{
this.displayName = displayName;
+
+ IdentityEventBroadcaster broadcaster = getEventBroadcaster();
+
+ if (broadcaster != null)
+ {
+ RoleUpdatedEvent event = new RoleUpdatedEvent(getId(), getName(), displayName);
+ broadcaster.fireEvent(event);
+ }
}
/**
@@ -146,4 +168,26 @@
{
return "Role[" + key + "," + name + "]";
}
+
+ private IdentityEventBroadcaster getEventBroadcaster()
+ {
+ if (eventBroadcaster == null)
+ {
+
+ try
+ {
+ MBeanServer mbeanServer = MBeanServerLocator.locateJBoss();
+ IdentityServiceController identityService = (IdentityServiceController)MBeanProxy.get(
+ IdentityServiceController.class, new ObjectName("portal:service=Module,type=IdentityServiceController"), mbeanServer);
+
+ eventBroadcaster = (IdentityEventBroadcaster)identityService.getIdentityContext().getObject(IdentityContext.TYPE_IDENTITY_EVENT_BROADCASTER);
+ }
+ catch (Exception e)
+ {
+ log.error("Failed to obtain IdentityEventBroadcaster. RoleUpdatedEvent won't be broadcasted");
+ }
+ }
+
+ return eventBroadcaster;
+ }
}
Modified: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/db/HibernateRoleModuleImpl.java
===================================================================
--- modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/db/HibernateRoleModuleImpl.java 2008-07-01 14:25:37 UTC (rev 11231)
+++ modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/db/HibernateRoleModuleImpl.java 2008-07-01 15:24:31 UTC (rev 11232)
@@ -207,6 +207,9 @@
HibernateRoleImpl role = new HibernateRoleImpl(name, displayName);
Session session = getCurrentSession();
session.save(role);
+
+ fireRoleCreatedEvent(role.getId(), role.getName());
+
return role;
}
catch (HibernateException e)
@@ -236,8 +239,13 @@
HibernateUserImpl user = (HibernateUserImpl)users.next();
user.getRoles().remove(role);
}
+
+ String name = role.getName();
+
session.delete(role);
session.flush();
+
+ fireRoleDestroyedEvent(id, name);
}
catch (HibernateException e)
{
Modified: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/db/HibernateUserProfileModuleImpl.java
===================================================================
--- modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/db/HibernateUserProfileModuleImpl.java 2008-07-01 14:25:37 UTC (rev 11231)
+++ modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/db/HibernateUserProfileModuleImpl.java 2008-07-01 15:24:31 UTC (rev 11232)
@@ -162,7 +162,7 @@
{
dbUser.getProfileMap().remove(propertyName);
}
- fireUserProfileChangedEvent(user.getId(), user.getUserName(), propertyName);
+ fireUserProfileChangedEvent(user.getId(), user.getUserName(), propertyName, propertyValue);
}
public Map getProperties(User user) throws IdentityException
Added: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/event/MembershipChangedEvent.java
===================================================================
--- modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/event/MembershipChangedEvent.java (rev 0)
+++ modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/event/MembershipChangedEvent.java 2008-07-01 15:24:31 UTC (rev 11232)
@@ -0,0 +1,92 @@
+/*
+* 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.identity.event;
+
+import java.util.Set;
+import java.util.Iterator;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class MembershipChangedEvent extends IdentityEvent
+{
+ private final Set userIds;
+
+ private final Set roleIds;
+
+ private final String representation;
+
+ public MembershipChangedEvent(Set userIds, Set roleIds)
+ {
+ if (userIds == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ if (roleIds == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ if (roleIds.size() > 1 && userIds.size() > 1)
+ {
+ throw new IllegalStateException("Either roleIds or userIds must contain only one element");
+ }
+
+ this.userIds = userIds;
+ this.roleIds = roleIds;
+
+ StringBuilder sb = new StringBuilder();
+
+ sb.append("MembershipChangedEvent[userIds=");
+ for (Iterator iterator = userIds.iterator(); iterator.hasNext();)
+ {
+ Object o = iterator.next();
+ if (iterator.hasNext())
+ {
+ sb.append(o.toString() + ", ");
+ }
+ else
+ {
+ sb.append(o.toString());
+ }
+ }
+ representation = sb.toString();
+ }
+
+ public Set getUserIds()
+ {
+ return userIds;
+ }
+
+ public Set getRoleIds()
+ {
+ return roleIds;
+ }
+
+ public String toString()
+ {
+ return representation;
+ }
+}
Copied: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/event/RoleCreatedEvent.java (from rev 11138, modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/event/UserCreatedEvent.java)
===================================================================
--- modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/event/RoleCreatedEvent.java (rev 0)
+++ modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/event/RoleCreatedEvent.java 2008-07-01 15:24:31 UTC (rev 11232)
@@ -0,0 +1,66 @@
+/******************************************************************************
+ * 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.identity.event;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class RoleCreatedEvent extends IdentityEvent
+{
+
+ /** . */
+ private final Object roleId;
+
+ /** . */
+ private final String roleName;
+
+ public RoleCreatedEvent(Object roleId, String roleName)
+ {
+ if (roleId == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (roleName == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.roleId = roleId;
+ this.roleName = roleName;
+ }
+
+ public Object getRoleId()
+ {
+ return roleId;
+ }
+
+ public String getRoleName()
+ {
+ return roleName;
+ }
+
+ public String toString()
+ {
+ return "RoleCreatedEvent[roleId=" + roleId + ",roleName=" + roleName + "]";
+ }
+}
\ No newline at end of file
Added: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/event/RoleDestroyedEvent.java
===================================================================
--- modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/event/RoleDestroyedEvent.java (rev 0)
+++ modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/event/RoleDestroyedEvent.java 2008-07-01 15:24:31 UTC (rev 11232)
@@ -0,0 +1,66 @@
+/******************************************************************************
+ * 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.identity.event;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class RoleDestroyedEvent extends IdentityEvent
+{
+
+ /** . */
+ private final Object roleId;
+
+ /** . */
+ private final String roleName;
+
+ public RoleDestroyedEvent(Object roleId, String roleName)
+ {
+ if (roleId == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (roleName == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.roleId = roleId;
+ this.roleName = roleName;
+ }
+
+ public Object getRoleId()
+ {
+ return roleId;
+ }
+
+ public String getRoleName()
+ {
+ return roleName;
+ }
+
+ public String toString()
+ {
+ return "RoleDestroyedEvent[roleId=" + roleId + ",roleName=" + roleName + "]";
+ }
+}
\ No newline at end of file
Added: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/event/RoleUpdatedEvent.java
===================================================================
--- modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/event/RoleUpdatedEvent.java (rev 0)
+++ modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/event/RoleUpdatedEvent.java 2008-07-01 15:24:31 UTC (rev 11232)
@@ -0,0 +1,85 @@
+/*
+* 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.identity.event;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class RoleUpdatedEvent extends IdentityEvent
+{
+ /** . */
+ private final Object roleId;
+
+ /** . */
+ private final String roleName;
+
+ /** . */
+ private String displayName;
+
+
+ public RoleUpdatedEvent(Object roleId, String roleName, String displayName)
+ {
+
+ this.displayName = displayName;
+ if (roleId == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (roleName == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (displayName == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+
+ this.roleId = roleId;
+ this.roleName = roleName;
+ this.displayName = displayName;
+
+ }
+
+ public Object getRoleId()
+ {
+ return roleId;
+ }
+
+ public String getRoleName()
+ {
+ return roleName;
+ }
+
+ public String getDisplayName()
+ {
+ return displayName;
+ }
+
+ public String toString()
+ {
+ return "RoleUpdatedEvent[roleId=" + roleId + ",roleName=" + roleName + ",displayName" + displayName + "]";
+ }
+
+}
Modified: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/event/UserProfileChangedEvent.java
===================================================================
--- modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/event/UserProfileChangedEvent.java 2008-07-01 14:25:37 UTC (rev 11231)
+++ modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/event/UserProfileChangedEvent.java 2008-07-01 15:24:31 UTC (rev 11232)
@@ -38,8 +38,12 @@
/** . */
private final String propertyName;
- public UserProfileChangedEvent(Object userId, String userName, String propertyName)
+ /** .*/
+ private Object newValue;
+
+ public UserProfileChangedEvent(Object userId, String userName, String propertyName, Object newValue)
{
+ this.newValue = newValue;
if (userId == null)
{
throw new IllegalArgumentException();
@@ -52,9 +56,16 @@
{
throw new IllegalArgumentException();
}
+
+ if (propertyName == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
this.userId = userId;
this.userName = userName;
this.propertyName = propertyName;
+ this.newValue = newValue;
}
public Object getUserId()
@@ -72,8 +83,13 @@
return propertyName;
}
+ public Object getNewValue()
+ {
+ return newValue;
+ }
+
public String toString()
{
- return "UserProfileChangedEvent[userId=" + userId + ",userName=" + userName + ",propertyName=" + propertyName + "]";
+ return "UserProfileChangedEvent[userId=" + userId + ",userName=" + userName + ",propertyName=" + propertyName + ",propertyValue" + newValue + "]";
}
}
\ No newline at end of file
Modified: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPRoleModule.java
===================================================================
--- modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPRoleModule.java 2008-07-01 14:25:37 UTC (rev 11231)
+++ modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPRoleModule.java 2008-07-01 15:24:31 UTC (rev 11232)
@@ -83,6 +83,8 @@
attrs.put(attr);
ldapContext.modifyAttributes(ldapr.getDn(), DirContext.REPLACE_ATTRIBUTE,attrs);
+
+ fireRoleUpdatedEvent(ldapr.getId(), ldapr.getName(), name);
}
catch (NamingException e)
{
Modified: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPRoleModuleImpl.java
===================================================================
--- modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPRoleModuleImpl.java 2008-07-01 14:25:37 UTC (rev 11231)
+++ modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPRoleModuleImpl.java 2008-07-01 15:24:31 UTC (rev 11232)
@@ -222,7 +222,11 @@
}
}
- return findRoleByName(name);
+ Role resultRole = findRoleByName(name);
+
+ fireRoleCreatedEvent(resultRole.getId(), resultRole.getName());
+
+ return resultRole;
}
//TODO: remove role assignments before?
@@ -246,6 +250,8 @@
{
log.debug("removing entry: " + ldapr.getDn());
ldapContext.unbind(ldapr.getDn());
+
+ fireRoleDestroyedEvent(ldapr.getId(), ldapr.getName());
}
catch (Exception e)
{
Modified: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPStaticGroupMembershipModuleImpl.java
===================================================================
--- modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPStaticGroupMembershipModuleImpl.java 2008-07-01 14:25:37 UTC (rev 11231)
+++ modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPStaticGroupMembershipModuleImpl.java 2008-07-01 15:24:31 UTC (rev 11232)
@@ -320,6 +320,7 @@
{
ldapContext.modifyAttributes(ldapRole.getDn(), DirContext.REMOVE_ATTRIBUTE, attrs);
}
+ fireMembershipChangedEvent(role, users);
}
catch (NamingException e)
{
@@ -461,6 +462,8 @@
ldapContext.modifyAttributes(roleDN, mods);
}
+ fireMembershipChangedEvent(user, roles);
+
//and that should be all...
}
catch (NamingException e)
Modified: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPStaticRoleMembershipModuleImpl.java
===================================================================
--- modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPStaticRoleMembershipModuleImpl.java 2008-07-01 14:25:37 UTC (rev 11231)
+++ modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPStaticRoleMembershipModuleImpl.java 2008-07-01 15:24:31 UTC (rev 11232)
@@ -351,6 +351,8 @@
ldapContext.modifyAttributes(userDN, mods);
}
+ fireMembershipChangedEvent(role, users);
+
//and that should be all...
}
catch (NamingException e)
@@ -438,6 +440,8 @@
attrs.put(member);
ldapContext.modifyAttributes(ldapUser.getDn(), DirContext.REPLACE_ATTRIBUTE, attrs);
+
+ fireMembershipChangedEvent(user, roles);
}
catch (NamingException e)
{
Modified: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserProfileModuleImpl.java
===================================================================
--- modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserProfileModuleImpl.java 2008-07-01 14:25:37 UTC (rev 11231)
+++ modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserProfileModuleImpl.java 2008-07-01 15:24:31 UTC (rev 11232)
@@ -214,7 +214,7 @@
attrs.put(attr);
ldapContext.modifyAttributes(ldapUser.getDn(), DirContext.REPLACE_ATTRIBUTE,attrs);
- fireUserProfileChangedEvent(user.getId(), user.getUserName(), propertyName);
+ fireUserProfileChangedEvent(user.getId(), user.getUserName(), propertyName, property);
}
catch (NamingException e)
{
Modified: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/service/MembershipModuleService.java
===================================================================
--- modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/service/MembershipModuleService.java 2008-07-01 14:25:37 UTC (rev 11231)
+++ modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/service/MembershipModuleService.java 2008-07-01 15:24:31 UTC (rev 11232)
@@ -23,8 +23,16 @@
import org.jboss.portal.identity.MembershipModule;
import org.jboss.portal.identity.IdentityContext;
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.User;
+import org.jboss.portal.identity.Role;
+import org.jboss.portal.identity.event.MembershipChangedEvent;
import org.jboss.portal.identity.info.ProfileInfo;
+import java.util.Set;
+import java.util.Iterator;
+import java.util.HashSet;
+
/**
* @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
* @version $Revision: 1.1 $
@@ -48,4 +56,46 @@
{
this.profileInfo = profileInfo;
}
+
+ protected void fireMembershipChangedEvent(Set userIds, Set roleIds) throws IdentityException
+ {
+ MembershipChangedEvent event = new MembershipChangedEvent(userIds, roleIds);
+ getIdentityEventBroadcaster().fireEvent(event);
+ }
+
+ protected void fireMembershipChangedEvent(User user, Set roles) throws IdentityException
+ {
+
+ Set roleIds = new HashSet();
+ Set userIds = new HashSet();
+
+ userIds.add(user.getId());
+
+ for (Iterator iterator = roles.iterator(); iterator.hasNext();)
+ {
+ Role role = (Role)iterator.next();
+ roleIds.add(role.getId());
+ }
+
+ fireMembershipChangedEvent(userIds, roleIds);
+ }
+
+ protected void fireMembershipChangedEvent(Role role, Set users) throws IdentityException
+ {
+
+ Set roleIds = new HashSet();
+ Set userIds = new HashSet();
+
+ roleIds.add(role.getId());
+
+ for (Iterator iterator = users.iterator(); iterator.hasNext();)
+ {
+ User user = (User)iterator.next();
+ userIds.add(user.getId());
+ }
+
+ fireMembershipChangedEvent(userIds, roleIds);
+ }
+
+
}
Modified: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/service/RoleModuleService.java
===================================================================
--- modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/service/RoleModuleService.java 2008-07-01 14:25:37 UTC (rev 11231)
+++ modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/service/RoleModuleService.java 2008-07-01 15:24:31 UTC (rev 11232)
@@ -23,6 +23,10 @@
import org.jboss.portal.identity.RoleModule;
import org.jboss.portal.identity.IdentityContext;
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.event.RoleCreatedEvent;
+import org.jboss.portal.identity.event.RoleDestroyedEvent;
+import org.jboss.portal.identity.event.RoleUpdatedEvent;
/**
* @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
@@ -36,4 +40,25 @@
{
super(IdentityContext.TYPE_ROLE_MODULE);
}
+
+ protected void fireRoleCreatedEvent(Object roleId, String roleName) throws IdentityException
+ {
+ RoleCreatedEvent event = new RoleCreatedEvent(roleId, roleName);
+ getIdentityEventBroadcaster().fireEvent(event);
+
+ }
+
+ protected void fireRoleDestroyedEvent(Object roleId, String roleName) throws IdentityException
+ {
+ RoleDestroyedEvent event = new RoleDestroyedEvent(roleId, roleName);
+ getIdentityEventBroadcaster().fireEvent(event);
+
+ }
+
+ protected void fireRoleUpdatedEvent(Object roleId, String roleName, String displayName) throws IdentityException
+ {
+ RoleUpdatedEvent event = new RoleUpdatedEvent(roleId, roleName, displayName);
+ getIdentityEventBroadcaster().fireEvent(event);
+ }
+
}
Modified: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/service/UserProfileModuleService.java
===================================================================
--- modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/service/UserProfileModuleService.java 2008-07-01 14:25:37 UTC (rev 11231)
+++ modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/service/UserProfileModuleService.java 2008-07-01 15:24:31 UTC (rev 11232)
@@ -83,9 +83,9 @@
this.profileConfigFile = profileConfigFile;
}
- protected void fireUserProfileChangedEvent(Object userId, String userName, String propertyName) throws IdentityException
+ protected void fireUserProfileChangedEvent(Object userId, String userName, String propertyName, Object newValue) throws IdentityException
{
- IdentityEvent event = new UserProfileChangedEvent(userId, userName, propertyName);
+ IdentityEvent event = new UserProfileChangedEvent(userId, userName, propertyName, newValue);
getIdentityEventBroadcaster().fireEvent(event);
}
Modified: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/IdentityTest.java
===================================================================
--- modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/IdentityTest.java 2008-07-01 14:25:37 UTC (rev 11231)
+++ modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/IdentityTest.java 2008-07-01 15:24:31 UTC (rev 11232)
@@ -11,6 +11,14 @@
import org.jboss.portal.identity.ProfileMap;
import org.jboss.portal.identity.NoSuchUserException;
import org.jboss.portal.identity.CachedUserImpl;
+import org.jboss.portal.identity.IdentityContext;
+import org.jboss.portal.identity.event.IdentityEventBroadcaster;
+import org.jboss.portal.identity.event.UserCreatedEvent;
+import org.jboss.portal.identity.event.MembershipChangedEvent;
+import org.jboss.portal.identity.event.RoleCreatedEvent;
+import org.jboss.portal.identity.event.RoleDestroyedEvent;
+import org.jboss.portal.identity.event.UserDestroyedEvent;
+import org.jboss.portal.identity.event.UserProfileChangedEvent;
import org.jboss.portal.common.util.CollectionBuilder;
import org.jboss.portal.common.p3p.P3PConstants;
@@ -176,13 +184,30 @@
public void testCreateUser() throws Exception
{
ctx.begin();
+
+ ctx.getEventBroadcaster().flushEventList();
User u3 = userModule.createUser("user3", "password");
+
+ assertEquals(1, ctx.getEventBroadcaster().getEventList().size());
+ UserCreatedEvent uce = (UserCreatedEvent)ctx.getEventBroadcaster().getEventList().iterator().next();
+ assertEquals("user3", uce.getUserName());
+ ctx.getEventBroadcaster().flushEventList();
+
Role g1 = roleModule.findRoleByName("role1");
membershipModule.assignRoles(u3, Collections.singleton(g1));
Assert.assertEquals("user3", u3.getUserName());
assertNotNull(membershipModule.getRoles(u3));
Assert.assertEquals(1, membershipModule.getRoles(u3).size());
Assert.assertEquals("role1", ((Role)membershipModule.getRoles(u3).iterator().next()).getName());
+
+ assertEquals(1, ctx.getEventBroadcaster().getEventList().size());
+ MembershipChangedEvent mce = (MembershipChangedEvent)ctx.getEventBroadcaster().getEventList().iterator().next();
+ assertEquals(1, mce.getUserIds().size());
+ assertEquals(1, mce.getRoleIds().size());
+ ctx.getEventBroadcaster().flushEventList();
+
+
+
ctx.commit();
ctx.begin();
@@ -213,9 +238,16 @@
public void testCreateRole() throws Exception
{
+ ctx.getEventBroadcaster().flushEventList();
ctx.begin();
Role g3 = roleModule.createRole("role3", "roleName");
Assert.assertEquals("role3", g3.getName());
+
+ assertEquals(1, ctx.getEventBroadcaster().getEventList().size());
+ RoleCreatedEvent rce = (RoleCreatedEvent)ctx.getEventBroadcaster().getEventList().iterator().next();
+ assertEquals("role3", rce.getRoleName());
+ ctx.getEventBroadcaster().flushEventList();
+
ctx.commit();
ctx.begin();
@@ -260,10 +292,17 @@
public void testRemoveRole() throws Exception
{
+ ctx.getEventBroadcaster().flushEventList();
ctx.begin();
Role g1 = roleModule.findRoleByName("role1");
Object id = g1.getId();
roleModule.removeRole(id);
+
+ assertEquals(1, ctx.getEventBroadcaster().getEventList().size());
+ RoleDestroyedEvent rde = (RoleDestroyedEvent)ctx.getEventBroadcaster().getEventList().iterator().next();
+ assertEquals("role1", rde.getRoleName());
+ ctx.getEventBroadcaster().flushEventList();
+
try
{
roleModule.findRoleById(id);
@@ -292,6 +331,7 @@
public void testRemoveUser() throws Exception
{
ctx.begin();
+ ctx.getEventBroadcaster().flushEventList();
User u1 = userModule.findUserByUserName("user1");
Object id = u1.getId();
userModule.removeUser(id);
@@ -303,6 +343,12 @@
catch (IdentityException expected)
{
}
+
+ assertEquals(1, ctx.getEventBroadcaster().getEventList().size());
+ UserDestroyedEvent rde = (UserDestroyedEvent)ctx.getEventBroadcaster().getEventList().iterator().next();
+ assertEquals("user1", rde.getUserName());
+ ctx.getEventBroadcaster().flushEventList();
+
ctx.commit();
ctx.begin();
@@ -518,9 +564,18 @@
{
}*/
//map.put(User.INFO_USER_VIEW_EMAIL_VIEW_REAL, "true");
+
+ ctx.getEventBroadcaster().flushEventList();
+
userProfileModule.setProperty(user, User.INFO_USER_VIEW_EMAIL_VIEW_REAL, Boolean.TRUE);
assertEquals(Boolean.TRUE.toString(), userProfileModule.getProperty(user, User.INFO_USER_VIEW_EMAIL_VIEW_REAL).toString());
+ UserProfileChangedEvent upue = (UserProfileChangedEvent)ctx.getEventBroadcaster().getEventList().iterator().next();
+ assertEquals(user.getUserName(), upue.getUserName());
+ assertEquals(User.INFO_USER_VIEW_EMAIL_VIEW_REAL, upue.getPropertyName());
+ assertEquals(Boolean.TRUE, upue.getNewValue());
+ ctx.getEventBroadcaster().flushEventList();
+
// Test boolean property
userProfileModule.setProperty(user, User.INFO_USER_VIEW_EMAIL_VIEW_REAL, Boolean.FALSE);
//assertEquals(Boolean.FALSE.toString(), map.get(User.INFO_USER_VIEW_EMAIL_VIEW_REAL).toString());
@@ -744,5 +799,9 @@
void begin();
void commit();
+
+ IdentityContext getIdentityContext();
+
+ TestEventBroadcaster getEventBroadcaster() throws Exception;
}
}
Added: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/TestEventBroadcaster.java
===================================================================
--- modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/TestEventBroadcaster.java (rev 0)
+++ modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/TestEventBroadcaster.java 2008-07-01 15:24:31 UTC (rev 11232)
@@ -0,0 +1,53 @@
+/*
+* 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.test.identity;
+
+import org.jboss.portal.identity.event.IdentityEvent;
+import org.jboss.portal.identity.event.IdentityEventBroadcaster;
+
+import java.util.List;
+import java.util.LinkedList;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class TestEventBroadcaster implements IdentityEventBroadcaster
+{
+ List eventList = new LinkedList();
+
+ public void fireEvent(IdentityEvent event)
+ {
+ eventList.add(event);
+ }
+
+ public List getEventList()
+ {
+ return eventList;
+ }
+
+ public void flushEventList()
+ {
+ eventList = new LinkedList();
+ }
+}
Modified: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/TestServiceLoader.java
===================================================================
--- modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/TestServiceLoader.java 2008-07-01 14:25:37 UTC (rev 11231)
+++ modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/TestServiceLoader.java 2008-07-01 15:24:31 UTC (rev 11232)
@@ -48,6 +48,9 @@
import org.jboss.kernel.Kernel;
import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import java.util.List;
+import java.util.LinkedList;
+
/**
* @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
* @version $Revision: 0.1 $
@@ -70,13 +73,8 @@
IdentityContext identityContext = bootstrapIdentityContext(kernel);
// IdentityEventBroadcaster
- IdentityEventBroadcaster broadcaster = new IdentityEventBroadcaster()
- {
- public void fireEvent(IdentityEvent event)
- {
- // Noop
- }
- };
+ IdentityEventBroadcaster broadcaster = new TestEventBroadcaster();
+
//
try
Modified: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/db/DBIdentityTestCase.java
===================================================================
--- modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/db/DBIdentityTestCase.java 2008-07-01 14:25:37 UTC (rev 11231)
+++ modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/db/DBIdentityTestCase.java 2008-07-01 15:24:31 UTC (rev 11232)
@@ -87,11 +87,13 @@
utc.populate();
}
+
+
public void testWorking() throws Exception
{
@@ -139,7 +141,7 @@
utc.testCreateRole();
}
- public void testCountUser() throws Exception
+ public void testCountUser() throws Exception
{
utc.testCountUser();
}
Modified: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/db/DBTestCase.java
===================================================================
--- modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/db/DBTestCase.java 2008-07-01 14:25:37 UTC (rev 11231)
+++ modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/db/DBTestCase.java 2008-07-01 15:24:31 UTC (rev 11232)
@@ -25,9 +25,11 @@
import org.jboss.portal.test.framework.embedded.HibernateSupport;
import org.jboss.portal.test.framework.mc.TestRuntimeContext;
import org.jboss.portal.test.identity.IdentityTest;
+import org.jboss.portal.test.identity.TestEventBroadcaster;
import org.jboss.portal.test.framework.junit.POJOJUnitTest;
import org.jboss.portal.test.framework.junit.JUnitAdapter;
import org.jboss.portal.identity.IdentityContext;
+import org.jboss.portal.identity.event.IdentityEventBroadcaster;
import org.jboss.portal.identity.service.UserProfileModuleService;
import org.jboss.portal.identity.service.MembershipModuleService;
import org.jboss.portal.identity.service.RoleModuleService;
@@ -197,5 +199,14 @@
assertTrue(hibernate.commitTransaction());
}
+ public IdentityContext getIdentityContext()
+ {
+ return identityContext;
+ }
+ public TestEventBroadcaster getEventBroadcaster() throws Exception
+ {
+ return (TestEventBroadcaster)getIdentityContext().getObject(IdentityContext.TYPE_IDENTITY_EVENT_BROADCASTER);
+ }
+
}
Modified: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPIdentityTestCase.java
===================================================================
--- modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPIdentityTestCase.java 2008-07-01 14:25:37 UTC (rev 11231)
+++ modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPIdentityTestCase.java 2008-07-01 15:24:31 UTC (rev 11232)
@@ -8,6 +8,7 @@
import org.jboss.portal.identity.RoleModule;
import org.jboss.portal.identity.MembershipModule;
import org.jboss.portal.identity.UserProfileModule;
+import org.jboss.portal.identity.event.IdentityEventBroadcaster;
import org.jboss.portal.identity.service.UserModuleService;
import org.jboss.portal.identity.service.RoleModuleService;
import org.jboss.portal.identity.service.MembershipModuleService;
Modified: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPTestCase.java
===================================================================
--- modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPTestCase.java 2008-07-01 14:25:37 UTC (rev 11231)
+++ modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPTestCase.java 2008-07-01 15:24:31 UTC (rev 11232)
@@ -29,12 +29,14 @@
import org.apache.log4j.Logger;
import org.apache.log4j.SimpleLayout;
import org.jboss.portal.identity.IdentityContext;
+import org.jboss.portal.identity.event.IdentityEventBroadcaster;
import org.jboss.portal.test.framework.mc.TestRuntimeContext;
import org.jboss.portal.test.framework.embedded.DSConfig;
import org.jboss.portal.test.framework.embedded.DataSourceSupport;
import org.jboss.portal.test.framework.embedded.HibernateSupport;
import org.jboss.portal.test.framework.junit.JUnitAdapter;
import org.jboss.portal.test.framework.junit.POJOJUnitTest;
+import org.jboss.portal.test.identity.TestEventBroadcaster;
import org.opends.server.tools.LDAPModify;
//import org.jboss.portal.test.framework.embedded.apacheds.ApacheDSService;
@@ -275,9 +277,19 @@
mainCtx.unbind(name);
}
+ public IdentityContext getIdentityContext()
+ {
+ return identityContext;
+ }
+
+ public TestEventBroadcaster getEventBroadcaster() throws Exception
+ {
+ return (TestEventBroadcaster)getIdentityContext().getObject(IdentityContext.TYPE_IDENTITY_EVENT_BROADCASTER);
+ }
+
/*public LDAPConnectionContext createConnectionContext()
- {
- *//*return new LDAPConnectionContext(directoryServerConfigParameter.getName(),
+{
+ *//*return new LDAPConnectionContext(directoryServerConfigParameter.getName(),
directoryServerConfigParameter.getURL(),
directoryServerConfigParameter.getContextFactory(),
directoryServerConfigParameter.getAdminDN(),
Modified: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/testsuite/build.xml
===================================================================
--- modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/testsuite/build.xml 2008-07-01 14:25:37 UTC (rev 11231)
+++ modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/testsuite/build.xml 2008-07-01 15:24:31 UTC (rev 11232)
@@ -140,28 +140,8 @@
<target name="clean">
<!-- remove generated test xml files -->
<delete>
- <fileset dir="../cms" includes="output/tests/*.log"/>
- <fileset dir="../cms" includes="output/tests/TEST-*.xml,output/tests/TEST-*.txt"/>
- <fileset dir="../core" includes="output/tests/*.log"/>
- <fileset dir="../core" includes="output/tests/TEST-*.xml,output/tests/TEST-*.txt"/>
- <fileset dir="../format" includes="*.log"/>
- <fileset dir="../format" includes="output/tests/TEST-*.xml,output/tests/TEST-*.txt"/>
- <fileset dir="../faces" includes="*.log"/>
- <fileset dir="../faces" includes="output/tests/TEST-*.xml,output/tests/TEST-*.txt"/>
- <fileset dir="../server" includes="*.log"/>
- <fileset dir="../server" includes="output/tests/TEST-*.xml,output/tests/TEST-*.txt"/>
- <fileset dir="../portlet" includes="*.log"/>
- <fileset dir="../portlet" includes="output/tests/TEST-*.xml,output/tests/TEST-*.txt"/>
- <fileset dir="../portlet-federation" includes="*.log"/>
- <fileset dir="../portlet-federation" includes="output/tests/TEST-*.xml,output/tests/TEST-*.txt"/>
- <fileset dir="../portlet-server" includes="*.log"/>
- <fileset dir="../portlet-server" includes="output/tests/TEST-*.xml,output/tests/TEST-*.txt"/>
- <fileset dir="../security" includes="*.log"/>
- <fileset dir="../security" includes="output/tests/TEST-*.xml,output/tests/TEST-*.txt"/>
<fileset dir="../identity" includes="*.log"/>
<fileset dir="../identity" includes="output/tests/TEST-*.xml,output/tests/TEST-*.txt"/>
- <fileset dir="../wsrp" includes="*.log"/>
- <fileset dir="../wsrp" includes="output/tests/TEST-*.xml,output/tests/TEST-*.txt"/>
<!--
<fileset dir="../theme" includes="*.log"/>
<fileset dir="../theme" includes="output/tests/TEST-*.xml,output/tests/TEST-*.txt"/>
16 years
JBoss Portal SVN: r11231 - in modules/presentation/trunk: ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model and 2 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-07-01 10:25:37 -0400 (Tue, 01 Jul 2008)
New Revision: 11231
Modified:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/PresentationClientAgent.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxLayout.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxObject.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxPage.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxPane.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIContextImpl.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ui/UIContext.java
Log:
start to improve and decouple ajax object / gwt widget life cycle in order to be able to perform update&refresh efficiently
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/PresentationClientAgent.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/PresentationClientAgent.java 2008-07-01 13:14:12 UTC (rev 11230)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/PresentationClientAgent.java 2008-07-01 14:25:37 UTC (rev 11231)
@@ -103,7 +103,7 @@
context.update(updates);
//
- context.getRoot().refresh();
+ context.getRoot().refresh(false);
//
bottom.add(context.getRoot().getWidget());
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxLayout.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxLayout.java 2008-07-01 13:14:12 UTC (rev 11230)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxLayout.java 2008-07-01 14:25:37 UTC (rev 11231)
@@ -22,10 +22,10 @@
******************************************************************************/
package org.jboss.portal.presentation.ajax.client.model;
-import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Panel;
+import com.google.gwt.user.client.ui.Widget;
import java.util.Iterator;
import java.util.Map;
@@ -42,17 +42,31 @@
/** . */
private Panel layout;
- /** . */
- private Widget widget;
-
-// private boolean
-
public AjaxLayout(String id, Map properties)
{
super(id, properties);
+ }
+ protected final void doRefresh(Panel parent)
+ {
+ if (layout != null)
+ {
+ parent.remove(layout);
+
+ //
+ for (Iterator i = layout.iterator();i.hasNext();)
+ {
+ Widget child = (Widget)i.next();
+
+ //
+ layout.remove(child);
+ }
+
+ //
+ this.layout = null;
+ }
+
//
- Panel widget = createPanel(id, properties);
Panel layout;
//
@@ -80,39 +94,25 @@
}
//
- widget.add(layout);
-
- //
layout.setStyleName("pf-Layout");
//
- this.layout = layout;
- this.widget = widget;
- }
+ for (Iterator i = getChildren().iterator();i.hasNext();)
+ {
+ AjaxObject child = (AjaxObject)i.next();
- protected abstract Panel createPanel(String id, Map properties);
+ //
+ layout.add(child.getWidget());
+ }
- protected void doAddChild(AjaxObject child)
- {
- Widget childWidget = child.getWidget();
+ //
+ parent.add(layout);
//
- layout.add(childWidget);
+ this.layout = layout;
}
- public Widget getWidget()
+ protected void doAddChild(AjaxObject child)
{
- return widget;
}
-
- protected void doRefresh()
- {
- for (Iterator i = getChildren().iterator();i.hasNext();)
- {
- AjaxObject child = (AjaxObject)i.next();
-
- //
- child.refresh();
- }
- }
}
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxObject.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxObject.java 2008-07-01 13:14:12 UTC (rev 11230)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxObject.java 2008-07-01 14:25:37 UTC (rev 11231)
@@ -27,6 +27,7 @@
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
+import java.util.Iterator;
import org.jboss.portal.presentation.ajax.client.model.update.ModelUpdate;
import org.jboss.portal.presentation.ajax.client.model.update.AddObject;
@@ -57,13 +58,74 @@
/** . */
private AjaxObject parent;
+ /** . */
+ private boolean stale;
+
protected AjaxObject(String id, Map properties)
{
this.id = id;
this.children = new HashMap();
this.properties = properties;
+ this.stale = true;
}
+ public final void createWidget()
+ {
+ for (Iterator i = children.values().iterator();i.hasNext();)
+ {
+ AjaxObject child = (AjaxObject)i.next();
+
+ //
+ child.createWidget();
+ }
+
+ //
+ doCreateWidget();
+ }
+
+ public final void destroyWidget()
+ {
+ doDestroyWidget();
+
+ //
+ for (Iterator i = children.values().iterator();i.hasNext();)
+ {
+ AjaxObject child = (AjaxObject)i.next();
+
+ //
+ child.destroyWidget();
+ }
+ }
+
+ public final void refresh(boolean force)
+ {
+ if (stale || force)
+ {
+ doRefresh(force);
+
+ //
+ stale = false;
+ }
+ }
+
+ private void addChild(AjaxObject child)
+ {
+ // Create relationship
+ children.put(child.getId(), child);
+ child.parent = this;
+
+ //
+ doAddChild(child);
+
+ //
+ stale = true;
+ }
+
+ public final boolean isStale()
+ {
+ return stale;
+ }
+
public final Object getPropertyValue(String propertyName)
{
return properties.get(propertyName);
@@ -89,25 +151,16 @@
return parent;
}
- private void addChild(AjaxObject child)
- {
- // Create relationship
- children.put(child.getId(), child);
- child.parent = this;
+ protected abstract void doCreateWidget();
- // Perform DOM wiring
- doAddChild(child);
- }
+ protected abstract void doRefresh(boolean force);
- public void refresh()
- {
- doRefresh();
- }
+ protected abstract void doDestroyWidget();
- protected abstract void doRefresh();
-
protected abstract void doAddChild(AjaxObject child);
+ protected abstract void doRemoveChild(AjaxObject child);
+
public abstract Widget getWidget();
public static class Context
@@ -178,6 +231,9 @@
// Wire to the context
objects.put(addObject.getObjectId(), object);
object.context = this;
+
+ // We create the widget
+ object.createWidget();
}
else if (update instanceof CreateChildren)
{
@@ -194,6 +250,9 @@
parent.addChild(child);
}
}
+
+ // We refresh the root
+ root.refresh(false);
}
}
}
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxPage.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxPage.java 2008-07-01 13:14:12 UTC (rev 11230)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxPage.java 2008-07-01 14:25:37 UTC (rev 11231)
@@ -22,11 +22,12 @@
******************************************************************************/
package org.jboss.portal.presentation.ajax.client.model;
-import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.Widget;
import java.util.Map;
+import java.util.Iterator;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
@@ -35,25 +36,57 @@
public class AjaxPage extends AjaxLayout
{
+ /** . */
+ private VerticalPanel widget;
+
public AjaxPage(String id, Map properties)
{
super(id, properties);
}
- protected Panel createPanel(String id, Map properties)
+ protected void doRefresh(boolean force)
{
+ for (Iterator i = getChildren().iterator();i.hasNext();)
+ {
+ AjaxObject child = (AjaxObject)i.next();
+
+ //
+ child.refresh(force);
+ }
+
+ //
+ doRefresh(widget);
+ }
+
+ public Widget getWidget()
+ {
+ return widget;
+ }
+
+ protected void doCreateWidget()
+ {
Label title = new Label();
- title.setText("Page " + id);
+ title.setText("Page " + getId());
title.setStyleName("pf-Title");
//
- VerticalPanel panel = new VerticalPanel();
- panel.setStyleName("pf-Pane");
+ VerticalPanel widget = new VerticalPanel();
+ widget.setStyleName("pf-Page");
//
- panel.add(title);
+ widget.add(title);
//
- return panel;
+ this.widget = widget;
}
+
+ protected void doDestroyWidget()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ protected void doRemoveChild(AjaxObject child)
+ {
+ throw new UnsupportedOperationException();
+ }
}
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxPane.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxPane.java 2008-07-01 13:14:12 UTC (rev 11230)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxPane.java 2008-07-01 14:25:37 UTC (rev 11231)
@@ -22,10 +22,12 @@
******************************************************************************/
package org.jboss.portal.presentation.ajax.client.model;
-import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.VerticalPanel;
+import com.google.gwt.user.client.ui.Widget;
+import com.google.gwt.user.client.ui.Hyperlink;
import java.util.Map;
+import java.util.Iterator;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
@@ -33,17 +35,50 @@
*/
public class AjaxPane extends AjaxLayout
{
+
+ /** . */
+ private VerticalPanel widget;
+
public AjaxPane(String id, Map properties)
{
super(id, properties);
}
- protected Panel createPanel(String id, Map properties)
+ protected void doCreateWidget()
{
- VerticalPanel panel = new VerticalPanel();
- panel.setStyleName("pf-Pane");
+ VerticalPanel widget = new VerticalPanel();
+ widget.setStyleName("pf-Pane");
//
- return panel;
+ this.widget = widget;
}
+
+ protected void doRefresh(boolean force)
+ {
+ for (Iterator i = getChildren().iterator();i.hasNext();)
+ {
+ AjaxObject child = (AjaxObject)i.next();
+
+ //
+ child.refresh(force);
+ }
+
+ //
+ doRefresh(widget);
+ }
+
+ protected void doDestroyWidget()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ protected void doRemoveChild(AjaxObject child)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Widget getWidget()
+ {
+ return widget;
+ }
}
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java 2008-07-01 13:14:12 UTC (rev 11230)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java 2008-07-01 14:25:37 UTC (rev 11231)
@@ -66,9 +66,12 @@
public AjaxWindow(String id, Map properties)
{
super(id, properties);
+ }
+ protected void doCreateWidget()
+ {
//
- Label title = new Label("Window " + id);
+ Label title = new Label("Window " + getId());
HTML markup = new HTML();
VerticalPanel widget = new VerticalPanel();
widget.add(title);
@@ -149,8 +152,8 @@
Map form = new HashMap();
Tools.serialize(current, form);
windowAction = new OpaqueWindowAction(uri, form);
-
+
/*
var enctype = current.enctype
@@ -214,7 +217,7 @@
if (stale != null)
{
log.info("Going to refresh portlet window " + staleObject);
- stale.refresh();
+ stale.refresh(true);
}
else
{
@@ -230,6 +233,16 @@
});
}
+ protected void doDestroyWidget()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ protected void doRemoveChild(AjaxObject child)
+ {
+ throw new UnsupportedOperationException();
+ }
+
protected void doAddChild(AjaxObject child)
{
throw new UnsupportedOperationException();
@@ -240,7 +253,7 @@
return widget;
}
- protected void doRefresh()
+ protected void doRefresh(boolean force)
{
final PresentationClientRemoteAsync remote = (PresentationClientRemoteAsync)GWT.create(PresentationClientRemote.class);
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIContextImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIContextImpl.java 2008-07-01 13:14:12 UTC (rev 11230)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIContextImpl.java 2008-07-01 14:25:37 UTC (rev 11231)
@@ -29,7 +29,7 @@
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
* @version $Revision: 630 $
*/
-public class UIContextImpl extends UIPageImpl implements UIContext
+public class UIContextImpl extends UILayoutImpl implements UIContext
{
public UIContextImpl(
StructuralObject structuralObject,
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ui/UIContext.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ui/UIContext.java 2008-07-01 13:14:12 UTC (rev 11230)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ui/UIContext.java 2008-07-01 14:25:37 UTC (rev 11231)
@@ -28,6 +28,6 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public interface UIContext extends UIPage
+public interface UIContext extends UILayout
{
}
\ No newline at end of file
16 years
JBoss Portal SVN: r11230 - in branches/JBoss_Portal_Branch_2_6/cms: src/main/org/jboss/portal/cms/impl and 3 other directories.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2008-07-01 09:14:12 -0400 (Tue, 01 Jul 2008)
New Revision: 11230
Added:
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/test/cms/commands/TestFileSize.java
Modified:
branches/JBoss_Portal_Branch_2_6/cms/build.xml
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/FileImpl.java
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ContentCreateCommand.java
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ContentGetCommand.java
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ContentGetVersionsCommand.java
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/FileGetListCommand.java
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/FileUpdateAndVersionCommand.java
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/FileUpdateCommand.java
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/model/File.java
Log:
JBPORTAL-2016 - CMS content object should have a method to return the size of the latest version of the file
Modified: branches/JBoss_Portal_Branch_2_6/cms/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/build.xml 2008-07-01 07:55:01 UTC (rev 11229)
+++ branches/JBoss_Portal_Branch_2_6/cms/build.xml 2008-07-01 13:14:12 UTC (rev 11230)
@@ -411,6 +411,7 @@
<test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFileCreate"/>
<test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFileUpdate"/>
+ <test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFileSize"/>
<test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFileArchiveUpload"/>
<test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFileGetVersion"/>
<test todir="${test.reports}" name="org.jboss.portal.test.cms.commands.TestFileGet"/>
Modified: branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/FileImpl.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/FileImpl.java 2008-07-01 07:55:01 UTC (rev 11229)
+++ branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/FileImpl.java 2008-07-01 13:14:12 UTC (rev 11230)
@@ -34,19 +34,8 @@
{
/** The serialVersionUID */
private static final long serialVersionUID = 7700626816158921578L;
- protected long fileSize;
protected Content content;
- public long getFileSize()
- {
- return fileSize;
- }
-
- public void setFileSize(long fileSize)
- {
- this.fileSize = fileSize;
- }
-
public void setContent(Locale locale, Content content)
{
this.content = content;
@@ -64,5 +53,10 @@
return this.content;
}
+
+ public long getSize()
+ {
+ return this.content.getSize();
+ }
}
Modified: branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ContentCreateCommand.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ContentCreateCommand.java 2008-07-01 07:55:01 UTC (rev 11229)
+++ branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ContentCreateCommand.java 2008-07-01 13:14:12 UTC (rev 11230)
@@ -62,6 +62,8 @@
contentNode.setProperty("portalcms:description", new StringValue(mFile.getContent().getDescription()));
contentNode.setProperty("portalcms:title", new StringValue(mFile.getContent().getTitle()));
contentNode.setProperty("portalcms:language", new StringValue(mFile.getContent().getLocale().getLanguage()));
+ contentNode.setProperty("portalcms:size", new StringValue(String
+ .valueOf(mFile.getContent().getBytes().length)));
if (mFile.getContent().getMimeType() != null)
Modified: branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ContentGetCommand.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ContentGetCommand.java 2008-07-01 07:55:01 UTC (rev 11229)
+++ branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ContentGetCommand.java 2008-07-01 13:14:12 UTC (rev 11230)
@@ -102,6 +102,11 @@
content.setLastModified(contentNode.getProperty("jcr:lastModified").getDate().getTime());
content.setBasePath(this.msPath + "/" + this.mlocale.getLanguage());
content.setDescription(contentNode.getProperty("portalcms:description").getString());
+ if (contentNode.hasProperty("portalcms:size"))
+ {
+ long size = Long.parseLong(contentNode.getProperty("portalcms:size").getString());
+ content.setSize(size);
+ }
if (this.msVersionNumber == null) // get LIVE
{
Modified: branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ContentGetVersionsCommand.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ContentGetVersionsCommand.java 2008-07-01 07:55:01 UTC (rev 11229)
+++ branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ContentGetVersionsCommand.java 2008-07-01 13:14:12 UTC (rev 11230)
@@ -95,10 +95,10 @@
content.setVersionUUID(node.getUUID());
content.setBytes("".getBytes());
- int size = 0;
+ long size = 0;
if (node.hasProperty("portalcms:size"))
{
- size = Integer.parseInt(node.getProperty("portalcms:size").getString());
+ size = Long.parseLong(node.getProperty("portalcms:size").getString());
}
content.setSize(size);
Modified: branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/FileGetListCommand.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/FileGetListCommand.java 2008-07-01 07:55:01 UTC (rev 11229)
+++ branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/FileGetListCommand.java 2008-07-01 13:14:12 UTC (rev 11230)
@@ -81,6 +81,11 @@
content.setEncoding(contentNode.getProperty("jcr:encoding").getString());
content.setStream(contentNode.getProperty("jcr:data").getStream());
content.setLocale(new Locale(contentNode.getProperty("portalcms:language").getString()));
+ if (contentNode.hasProperty("portalcms:size"))
+ {
+ long size = Long.parseLong(contentNode.getProperty("portalcms:size").getString());
+ content.setSize(size);
+ }
contents.add(content);
}
}
Modified: branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/FileUpdateAndVersionCommand.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/FileUpdateAndVersionCommand.java 2008-07-01 07:55:01 UTC (rev 11229)
+++ branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/FileUpdateAndVersionCommand.java 2008-07-01 13:14:12 UTC (rev 11230)
@@ -24,6 +24,7 @@
import org.apache.jackrabbit.value.BinaryValue;
import org.apache.jackrabbit.value.DateValue;
+import org.apache.jackrabbit.value.StringValue;
import org.jboss.portal.cms.CMSMimeMappings;
import org.jboss.portal.cms.impl.jcr.JCRCommand;
import org.jboss.portal.cms.impl.jcr.util.VersionUtil;
@@ -66,6 +67,8 @@
contentNode.setProperty("jcr:encoding", "UTF-8");
contentNode.setProperty("jcr:data", new BinaryValue(mFile.getContent().getBytes()));
contentNode.setProperty("jcr:lastModified", timestamp);
+ contentNode.setProperty("portalcms:size", new StringValue(String
+ .valueOf(mFile.getContent().getBytes().length)));
if (mFile.getContent().getMimeType() != null)
{
@@ -91,7 +94,7 @@
//Update the lastModified Property of the FileNode of this content
Node fileNode = (Node)context.getSession().getItem(mFile.getBasePath());
- fileNode.setProperty("jcr:lastModified", timestamp);
+ fileNode.setProperty("jcr:lastModified", timestamp);
// Update the folder modified date
fileNode.getParent().setProperty("portalcms:lastmodified", timestamp);
Modified: branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/FileUpdateCommand.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/FileUpdateCommand.java 2008-07-01 07:55:01 UTC (rev 11229)
+++ branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/FileUpdateCommand.java 2008-07-01 13:14:12 UTC (rev 11230)
@@ -24,6 +24,7 @@
import org.apache.jackrabbit.value.BinaryValue;
import org.apache.jackrabbit.value.DateValue;
+import org.apache.jackrabbit.value.StringValue;
import org.jboss.portal.cms.CMSMimeMappings;
import org.jboss.portal.cms.impl.jcr.JCRCommand;
import org.jboss.portal.cms.model.File;
@@ -65,6 +66,8 @@
contentNode.setProperty("jcr:encoding", "UTF-8");
contentNode.setProperty("jcr:data", new BinaryValue(mFile.getContent().getBytes()));
contentNode.setProperty("jcr:lastModified", timestamp);
+ contentNode.setProperty("portalcms:size", new StringValue(String
+ .valueOf(mFile.getContent().getBytes().length)));
if (mFile.getContent().getMimeType() != null)
{
@@ -86,7 +89,7 @@
//Update the lastModified Property of the FileNode of this content
Node fileNode = (Node)context.getSession().getItem(mFile.getBasePath());
- fileNode.setProperty("jcr:lastModified", timestamp);
+ fileNode.setProperty("jcr:lastModified", timestamp);
// Update the folder modified date
fileNode.getParent().setProperty("portalcms:lastmodified", timestamp);
Modified: branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/model/File.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/model/File.java 2008-07-01 07:55:01 UTC (rev 11229)
+++ branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/model/File.java 2008-07-01 13:14:12 UTC (rev 11230)
@@ -38,4 +38,6 @@
void setContent(Locale locale, Content content);
Content getContent();
+
+ long getSize();
}
Added: branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/test/cms/commands/TestFileSize.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/test/cms/commands/TestFileSize.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/test/cms/commands/TestFileSize.java 2008-07-01 13:14:12 UTC (rev 11230)
@@ -0,0 +1,178 @@
+/******************************************************************************
+ * 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.test.cms.commands;
+
+import junit.framework.TestSuite;
+import org.jboss.portal.cms.Command;
+import org.jboss.portal.cms.impl.ContentImpl;
+import org.jboss.portal.cms.impl.FileImpl;
+import org.jboss.portal.cms.model.Content;
+import org.jboss.portal.cms.model.File;
+
+import java.util.Locale;
+
+
+/**
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class TestFileSize extends AbstractCommandTestCase
+{
+ String sFilePath = "/testdoc.gif";
+
+ String sCopyToFilePath = "/testdoccopy.gif";
+
+ // zip vars
+ String sZipPath = "/poop";
+
+ String sZipFile = "resources/test/jcr/ziptest.zip";
+
+ String sJPG = "/hibernate_logo.gif";
+
+ String sText = "/training.txt";
+
+
+ /**
+ *
+ *
+ */
+ public TestFileSize()
+ {
+ }
+
+ /**
+ *
+ *
+ */
+ public static TestSuite suite() throws Exception
+ {
+ return createTestSuite(TestFileSize.class);
+ }
+
+ /**
+ *
+ *
+ */
+ public void testFileCreate() throws Exception
+ {
+ // create file english
+ File file = new FileImpl();
+ file.setBasePath(sFilePath);
+
+ Content content = new ContentImpl();
+ content.setEncoding("UTF-8");
+ content.setTitle("English Title");
+ content.setDescription("English Description");
+ content.setBasePath(sFilePath + "/" + Locale.ENGLISH.getLanguage());
+ content.setBytes("1234567890".getBytes());
+ content.setMimeType("image/gif");
+ file.setContent(Locale.ENGLISH, content);
+
+ // save english file
+ Command saveFileCMD = service.getCommandFactory().createFileSaveCommand(file);
+ service.execute(saveFileCMD);
+
+ //save english content
+ Command saveContentCMD = service.getCommandFactory().createContentSaveCommand(file);
+ service.execute(saveContentCMD);
+
+ // version the english content node
+ Command verCMD = service.getCommandFactory().createContentCreateNewVersionCommand(content, true);
+ service.execute(verCMD);
+
+ Command fileGet = service.getCommandFactory().createFileGetCommand(sFilePath, Locale.ENGLISH);
+ File cour = (File)service.execute(fileGet);
+ assertEquals("File Size Incorrect", cour.getSize(), "1234567890".length());
+
+
+ //create content spanish
+ Content contentSP = new ContentImpl();
+ contentSP.setEncoding("UTF-8");
+ contentSP.setTitle("Spanish Title");
+ contentSP.setDescription("Spanish Description");
+ contentSP.setBasePath(sFilePath + "/es");
+ contentSP.setBytes("0987654321/es".getBytes());
+ contentSP.setMimeType("image/gif");
+ file.setContent(new Locale("es"), contentSP);
+
+ //save spanish content
+ Command saveSPContentCMD = service.getCommandFactory().createContentSaveCommand(file);
+ service.execute(saveSPContentCMD);
+
+ // version the spanish content node
+ Command verSPCMD = service.getCommandFactory().createContentCreateNewVersionCommand(contentSP, true);
+ service.execute(verSPCMD);
+
+ fileGet = service.getCommandFactory().createFileGetCommand(sFilePath, new Locale("es"));
+ cour = (File)service.execute(fileGet);
+ assertEquals("File Size Incorrect", cour.getSize(), "0987654321/es".length());
+ }
+
+ /**
+ *
+ *
+ */
+ public void testFileUpdate() throws Exception
+ {
+ // create file english
+ File file = new FileImpl();
+ file.setBasePath(sFilePath);
+
+ Content content = new ContentImpl();
+ content.setEncoding("UTF-8");
+ content.setTitle("English Title");
+ content.setDescription("English Description");
+ content.setBasePath(sFilePath + "/" + Locale.ENGLISH.getLanguage());
+ content.setBytes("1234567890".getBytes());
+ content.setMimeType("image/gif");
+ file.setContent(Locale.ENGLISH, content);
+
+ // save english file
+ Command saveFileCMD = service.getCommandFactory().createFileSaveCommand(file);
+ service.execute(saveFileCMD);
+
+ //save english content
+ Command saveContentCMD = service.getCommandFactory().createContentSaveCommand(file);
+ service.execute(saveContentCMD);
+
+ // version the english content node
+ Command verCMD = service.getCommandFactory().createContentCreateNewVersionCommand(content, true);
+ service.execute(verCMD);
+
+ Command fileGet = service.getCommandFactory().createFileGetCommand(sFilePath, Locale.ENGLISH);
+ File cour = (File)service.execute(fileGet);
+ assertEquals("File Size Incorrect", cour.getSize(), "1234567890".length());
+ assertEquals("File Content Incorrect", new String(cour.getContent().getBytes()), "1234567890");
+
+ //Now Update this content and create a new version
+ content.setBytes("1234567890/updated".getBytes());
+ Command cmdUpdate = service.getCommandFactory().createUpdateFileCommand(file, content, true);
+ service.execute(cmdUpdate);
+
+ fileGet = service.getCommandFactory().createFileGetCommand(sFilePath, Locale.ENGLISH);
+ cour = (File)service.execute(fileGet);
+ assertEquals("File Size Incorrect", cour.getSize(), "1234567890/updated".length());
+ assertEquals("File Content Incorrect", new String(cour.getContent().getBytes()), "1234567890/updated");
+ }
+}
16 years