Author: chris.laprun(a)jboss.com
Date: 2010-09-07 17:59:31 -0400 (Tue, 07 Sep 2010)
New Revision: 4076
Added:
components/wsrp/trunk/admin-gui/src/main/webapp/jsf/consumers/exports/confirmDeleteExport.xhtml
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/migration/
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/migration/MigrationServiceTestCase.java
Modified:
components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ConsumerBean.java
components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ConsumerManagerBean.java
components/wsrp/trunk/admin-gui/src/main/webapp/WEB-INF/classes/Resource.properties
components/wsrp/trunk/admin-gui/src/main/webapp/WEB-INF/classes/Resource_fr.properties
components/wsrp/trunk/admin-gui/src/main/webapp/WEB-INF/faces-config.xml
components/wsrp/trunk/admin-gui/src/main/webapp/jsf/consumers/consumers.xhtml
components/wsrp/trunk/admin-gui/src/main/webapp/jsf/consumers/exports/export.xhtml
components/wsrp/trunk/admin-gui/src/main/webapp/jsf/consumers/exports/exportDetail.xhtml
components/wsrp/trunk/admin-gui/src/main/webapp/jsf/consumers/exports/exports.xhtml
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/WSRPConsumer.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/WSRPConsumerImpl.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/migration/ExportInfo.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/migration/MigrationService.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/support/MockWSRPConsumer.java
Log:
- GTNWSRP-61: improved many aspects of the UI
+ now require a consumer refresh to see import/export actions since we need to check
that the operation is available first
+ implemented export list view
+ started adding implementations for export list actions
+ added ExportInfoDisplay and FailedPortletsDisplay classes to better control how an
ExportInfo is displayed
- Added getHumanReadable* methods on ExportInfo to display times in human readable
format.
- Added WSRPConsumer.isSupportsExport method to determine whether a given consumer
supports import/export (right now, only checks protocol version)
Modified:
components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ConsumerBean.java
===================================================================
---
components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ConsumerBean.java 2010-09-07
20:33:07 UTC (rev 4075)
+++
components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ConsumerBean.java 2010-09-07
21:59:31 UTC (rev 4076)
@@ -34,15 +34,23 @@
import org.gatein.wsrp.consumer.migration.ExportInfo;
import org.gatein.wsrp.consumer.registry.ConsumerRegistry;
+import javax.faces.event.ActionEvent;
import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;
+import javax.xml.namespace.QName;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
+import java.util.Calendar;
import java.util.Collection;
import java.util.Collections;
+import java.util.Date;
import java.util.LinkedList;
import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+import java.util.SortedMap;
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
@@ -71,7 +79,7 @@
private DataModel portletHandles;
private DataModel existingExports;
- private ExportInfo currentExport;
+ private ExportInfoDisplay currentExport;
public void setRegistry(ConsumerRegistry registry)
{
@@ -521,7 +529,7 @@
}
}
- public String export()
+ public String exportPortlets()
{
if (consumer != null)
{
@@ -537,7 +545,7 @@
try
{
- currentExport = consumer.exportPortlets(selectedHandles);
+ currentExport = new
ExportInfoDisplay(consumer.exportPortlets(selectedHandles), beanContext.getLocale());
}
catch (Exception e)
{
@@ -551,7 +559,7 @@
return null;
}
- public ExportInfo getCurrentExport()
+ public ExportInfoDisplay getCurrentExport()
{
return currentExport;
}
@@ -560,12 +568,53 @@
{
if (existingExports == null)
{
- existingExports = new
ListDataModel(consumer.getMigrationService().getAvailableExportInfos());
+ Locale locale = beanContext.getLocale();
+ List<ExportInfo> availableExportInfos =
consumer.getMigrationService().getAvailableExportInfos();
+ List<ExportInfoDisplay> exportDisplays = new
ArrayList<ExportInfoDisplay>(availableExportInfos.size());
+ for (ExportInfo exportInfo : availableExportInfos)
+ {
+ exportDisplays.add(new ExportInfoDisplay(exportInfo, locale));
+ }
+ existingExports = new ListDataModel(exportDisplays);
}
return existingExports;
}
+ public String viewExport()
+ {
+ selectExport();
+
+ return ConsumerManagerBean.EXPORT_DETAIL;
+ }
+
+ public String importPortlets()
+ {
+ return ConsumerManagerBean.EXPORTS;
+ }
+
+ public String deleteExport()
+ {
+ ExportInfo export = currentExport.getExport();
+ if(consumer.getMigrationService().remove(export) == export)
+ {
+ existingExports = null; // force rebuild of export list
+ currentExport = null;
+ }
+
+ return ConsumerManagerBean.EXPORTS;
+ }
+
+ public void selectExport(ActionEvent actionEvent)
+ {
+ selectExport();
+ }
+
+ public void selectExport()
+ {
+ currentExport = (ExportInfoDisplay) existingExports.getRowData();
+ }
+
public static class SelectablePortletHandle
{
private String handle;
@@ -591,4 +640,82 @@
this.selected = selected;
}
}
+
+ public static class ExportInfoDisplay
+ {
+ private ExportInfo export;
+ private Locale locale;
+ private List<FailedPortletsDisplay> failedPortlets;
+
+ public ExportInfoDisplay(ExportInfo export, Locale locale)
+ {
+ this.export = export;
+ this.locale = locale;
+ SortedMap<QName,List<String>>
errorCodesToFailedPortletHandlesMapping =
export.getErrorCodesToFailedPortletHandlesMapping();
+
if(ParameterValidation.existsAndIsNotEmpty(errorCodesToFailedPortletHandlesMapping))
+ {
+ failedPortlets = new
ArrayList<FailedPortletsDisplay>(errorCodesToFailedPortletHandlesMapping.size());
+ for (Map.Entry<QName, List<String>> entry :
errorCodesToFailedPortletHandlesMapping.entrySet())
+ {
+ failedPortlets.add(new FailedPortletsDisplay(entry.getKey(),
entry.getValue()));
+ }
+ }
+ else
+ {
+ failedPortlets = Collections.emptyList();
+ }
+ }
+
+ public String getExportTime()
+ {
+ return export.getHumanReadableExportTime(locale);
+ }
+
+ public String getExpirationTime()
+ {
+ return export.getHumanReadableExpirationTime(locale);
+ }
+
+ public boolean isHasFailedPortlets()
+ {
+ return !failedPortlets.isEmpty();
+ }
+
+ public List<String> getExportedPortlets()
+ {
+ return export.getExportedPortletHandles();
+ }
+
+ public List<FailedPortletsDisplay> getFailedPortlets()
+ {
+ return failedPortlets;
+ }
+
+ public ExportInfo getExport()
+ {
+ return export;
+ }
+ }
+
+ public static class FailedPortletsDisplay
+ {
+ private QName errorCode;
+ private List<String> faiedPortlets;
+
+ public FailedPortletsDisplay(QName errorCode, List<String> failedPortlets)
+ {
+ this.errorCode = errorCode;
+ this.faiedPortlets = failedPortlets;
+ }
+
+ public QName getErrorCode()
+ {
+ return errorCode;
+ }
+
+ public List<String> getFailedPortlets()
+ {
+ return faiedPortlets;
+ }
+ }
}
Modified:
components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ConsumerManagerBean.java
===================================================================
---
components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ConsumerManagerBean.java 2010-09-07
20:33:07 UTC (rev 4075)
+++
components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ConsumerManagerBean.java 2010-09-07
21:59:31 UTC (rev 4076)
@@ -53,6 +53,7 @@
private static final String REFRESH_EXCEPTION =
"bean_consumermanager_refresh_exception";
static final String CONFIGURE_CONSUMER = "configureConsumer";
static final String EXPORT = "export";
+ public static final String EXPORTS = "exports";
static final String EXPORT_DETAIL = "exportDetail";
static final String CONSUMERS = "consumers";
@@ -248,10 +249,8 @@
{
if (refreshConsumerId() != null)
{
- WSRPConsumer consumer = getSelectedConsumer();
-
-
- return configureConsumer();
+ setConsumerIdInSession(false);
+ return EXPORTS;
}
else
{
Modified:
components/wsrp/trunk/admin-gui/src/main/webapp/WEB-INF/classes/Resource.properties
===================================================================
---
components/wsrp/trunk/admin-gui/src/main/webapp/WEB-INF/classes/Resource.properties 2010-09-07
20:33:07 UTC (rev 4075)
+++
components/wsrp/trunk/admin-gui/src/main/webapp/WEB-INF/classes/Resource.properties 2010-09-07
21:59:31 UTC (rev 4076)
@@ -82,17 +82,30 @@
portlets_table_column_include = Include in export?
portlets_table_column_portlet_name = Portlet
portlets_table_export = Export
-export_detail_export_time = Export time:
-export_detail_expiration_time = Expiration time:
-export_detail_portlets = Exported portlets:
-export_detail_failed = Failed portlets:
+export_detail_export_time = Export time
+export_detail_expiration_time = Expiration time
+export_detail_portlets = Exported portlets
+export_detail_failed = Failed portlets
+export_detail_has_failed = Has failed portlets?
export_detail_exported_portlet_name = Exported portlet handle
export_detail_failed_portlet_error = Error code
export_detail_failed_portlet_portlets = Failed portlets
export_detail_failed_portlet_none = No failed portlets.
export_detail_exports = Back to exports list
export_detail_consumers = Back to consumers list
+exports_actions = Actions
+exports_actions_delete = Delete
+exports_actions_view = View
+exports_actions_use = Use for import
+# Confirm deletion of an export
+confirm_delete_export_title = Delete export from {0}?
+confirm_delete_export_message = You are about to delete export from {0}!
+confirm_detete_export_proceed = Are you sure you want to proceed?
+confirm_delete_export_submit = Delete export
+confirm_delete_export_cancel = Cancel
+
+
# Consumer editing screen
edit_consumer_producer = Producer id:
edit_consumer_cache = Cache expiration:
Modified:
components/wsrp/trunk/admin-gui/src/main/webapp/WEB-INF/classes/Resource_fr.properties
===================================================================
---
components/wsrp/trunk/admin-gui/src/main/webapp/WEB-INF/classes/Resource_fr.properties 2010-09-07
20:33:07 UTC (rev 4075)
+++
components/wsrp/trunk/admin-gui/src/main/webapp/WEB-INF/classes/Resource_fr.properties 2010-09-07
21:59:31 UTC (rev 4076)
@@ -35,7 +35,7 @@
path_consumers_inactive = inactif
path_consumers_refreshNeeded = (rafra\u00eechissement requis)
confirm_delete_consumer_cancel=Annuler
-confirm_delete_consumer_message=Vous \u00eates sur le point d''effacer le
concommateur ''{0}''!
+confirm_delete_consumer_message=Vous \u00eates sur le point d''effacer le
consommateur ''{0}''!
confirm_delete_consumer_submit=Effacer consommateur
confirm_delete_consumer_title=Voulez-vous r\u00e9ellement effacer le consommateur
''{0}''?
confirm_detete_consumer_proceed=\u00cates-vous certains de vouloir proc\u00e9der?
@@ -152,12 +152,21 @@
portlets_table_column_portlet_name=Portlet
portlets_table_export=Exporter
export_detail_consumers=Retour � la liste des consommateurs
-export_detail_expiration_time=Date d'expiration:
-export_detail_export_time=Date d'export:
+export_detail_expiration_time=Date d'expiration
+export_detail_export_time=Date d'export
export_detail_exported_portlet_name=Identifiant de la portlet export�e
export_detail_exports=Retour � la liste des exports
export_detail_failed=Portlets en erreur:
export_detail_failed_portlet_error=Code d'erreur
export_detail_failed_portlet_none=Aucune portlet en erreur.
export_detail_failed_portlet_portlets=Portlets en erreur
-export_detail_portlets=Portlets export�es:
\ No newline at end of file
+export_detail_portlets=Portlets export�es
+export_detail_has_failed=A des portlets en erreur?
+exports_actions=Actions
+exports_actions_delete=Effacer
+exports_actions_view=Voir
+exports_actions_use=Utiliser pour import
+confirm_delete_export_cancel=Annuler
+confirm_delete_export_message=Vous \u00eates sur le point d''effacer
l''export du {0}!
+confirm_delete_export_submit=Effacer export
+confirm_delete_export_title=Voulez-vous r\u00e9ellement effacer l'export du {0}?
\ No newline at end of file
Modified: components/wsrp/trunk/admin-gui/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- components/wsrp/trunk/admin-gui/src/main/webapp/WEB-INF/faces-config.xml 2010-09-07
20:33:07 UTC (rev 4075)
+++ components/wsrp/trunk/admin-gui/src/main/webapp/WEB-INF/faces-config.xml 2010-09-07
21:59:31 UTC (rev 4076)
@@ -167,5 +167,9 @@
<from-outcome>exportDetail</from-outcome>
<to-view-id>/jsf/consumers/exports/exportDetail.xhtml</to-view-id>
</navigation-case>
+ <navigation-case>
+ <from-outcome>confirmDeleteExport</from-outcome>
+
<to-view-id>/jsf/consumers/exports/confirmDeleteExport.xhtml</to-view-id>
+ </navigation-case>
</navigation-rule>
</faces-config>
Modified: components/wsrp/trunk/admin-gui/src/main/webapp/jsf/consumers/consumers.xhtml
===================================================================
---
components/wsrp/trunk/admin-gui/src/main/webapp/jsf/consumers/consumers.xhtml 2010-09-07
20:33:07 UTC (rev 4075)
+++
components/wsrp/trunk/admin-gui/src/main/webapp/jsf/consumers/consumers.xhtml 2010-09-07
21:59:31 UTC (rev 4076)
@@ -89,16 +89,19 @@
<f:param name="id"
value="#{cons.producerId}"/>
#{i18n.consumers_table_action_delete}
</h:commandLink>
- |
- <h:commandLink action="#{consumersMgr.importPortlets}"
styleClass="actionImport" id="import">
- <f:param name="id"
value="#{cons.producerId}"/>
- #{i18n.consumers_table_action_import}
- </h:commandLink>
- |
- <h:commandLink action="#{consumersMgr.exportPortlets}"
styleClass="actionExport" id="export">
- <f:param name="id"
value="#{cons.producerId}"/>
- #{i18n.consumers_table_action_export}
- </h:commandLink>
+ <h:panelGroup rendered="#{cons.active and
cons.supportsExport}">
+ <h:panelGroup rendered="#{!
cons.migrationService.availableExportInfosEmpty}">|
+ <h:commandLink action="#{consumersMgr.importPortlets}"
styleClass="actionImport" id="import">
+ <f:param name="id"
value="#{cons.producerId}"/>
+ #{i18n.consumers_table_action_import}
+ </h:commandLink>
+ </h:panelGroup>
+ |
+ <h:commandLink action="#{consumersMgr.exportPortlets}"
styleClass="actionExport" id="export">
+ <f:param name="id"
value="#{cons.producerId}"/>
+ #{i18n.consumers_table_action_export}
+ </h:commandLink>
+ </h:panelGroup>
</h:column>
</h:dataTable>
</h:form>
Added:
components/wsrp/trunk/admin-gui/src/main/webapp/jsf/consumers/exports/confirmDeleteExport.xhtml
===================================================================
---
components/wsrp/trunk/admin-gui/src/main/webapp/jsf/consumers/exports/confirmDeleteExport.xhtml
(rev 0)
+++
components/wsrp/trunk/admin-gui/src/main/webapp/jsf/consumers/exports/confirmDeleteExport.xhtml 2010-09-07
21:59:31 UTC (rev 4076)
@@ -0,0 +1,96 @@
+<!--
+ ~ JBoss, a division of Red Hat
+ ~ Copyright 2010, 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.
+ -->
+
+<ui:decorate template="../consumerTemplate.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:webui="http://jboss.org/gatein">
+
+ <ui:param name="title" value=""/>
+ <ui:define name="content">
+
+ <div class="portlet-msg">
+ <div class="portlet-msg-icon">
+ <h:graphicImage url="/img/msgIcon_Warning.gif"
alt="/!\"/>
+ </div>
+ <div class="portlet-msg-body">
+ <h3>
+ <h:outputFormat
value="#{i18n.confirm_delete_export_title}">
+ <f:param
value="#{consumer.currentExport.exportTime}"/>
+ </h:outputFormat>
+ </h3>
+
+ <p class="portlet-msg-alert">
+ <h:outputFormat
value="#{i18n.confirm_delete_export_message}">
+ <f:param
value="#{consumer.currentExport.exportTime}"/>
+ </h:outputFormat>
+ </p>
+
+ <p
class="portlet-class">#{i18n.confirm_detete_export_proceed}</p>
+
+ <h:form id="confirm-delete-form">
+ <table class="ActionContainer">
+ <tr>
+ <td>
+ <div class="ButtonLeft">
+ <div class="ButtonRight">
+ <div class="ButtonMiddle">
+ <h:commandLink id="destroy-link"
action="#{consumer.deleteExport}"
+
value="#{i18n.confirm_delete_export_submit}"/>
+ </div>
+ </div>
+ </div>
+ </td>
+ <td>
+ <div class="ButtonLeft">
+ <div class="ButtonRight">
+ <div class="ButtonMiddle">
+ <h:commandLink id="cancel-link"
action="exports"
+
value="#{i18n.confirm_delete_export_cancel}"/>
+ </div>
+ </div>
+ </div>
+ </td>
+ </tr>
+ </table>
+
+
+ <ui:remove><webui:commandButton id="destroy-link"
+ action="destroyConsumer"
+ backingBean="#{consumersMgr}"
+
value="#{i18n.confirm_delete_consumer_submit}">
+ <f:param name="id"
value="#{consumersMgr.selectedConsumer.producerId}"/>
+ </webui:commandButton>
+
+ <webui:commandButton id="cancel-link"
+ action="listConsumers"
+ backingBean="#{consumersMgr}"
+
value="#{i18n.confirm_delete_consumer_cancel}"/></ui:remove>
+ </h:form>
+ </div>
+ </div>
+
+ </ui:define>
+
+</ui:decorate>
\ No newline at end of file
Modified:
components/wsrp/trunk/admin-gui/src/main/webapp/jsf/consumers/exports/export.xhtml
===================================================================
---
components/wsrp/trunk/admin-gui/src/main/webapp/jsf/consumers/exports/export.xhtml 2010-09-07
20:33:07 UTC (rev 4075)
+++
components/wsrp/trunk/admin-gui/src/main/webapp/jsf/consumers/exports/export.xhtml 2010-09-07
21:59:31 UTC (rev 4076)
@@ -50,7 +50,7 @@
<div class="ButtonLeft">
<div class="ButtonRight">
<div class="ButtonMiddle">
- <h:commandButton id="exportButton"
action="#{consumer.export}"
+ <h:commandButton id="exportButton"
action="#{consumer.exportPortlets}"
value="#{i18n.portlets_table_export}"/>
</div>
</div>
Modified:
components/wsrp/trunk/admin-gui/src/main/webapp/jsf/consumers/exports/exportDetail.xhtml
===================================================================
---
components/wsrp/trunk/admin-gui/src/main/webapp/jsf/consumers/exports/exportDetail.xhtml 2010-09-07
20:33:07 UTC (rev 4075)
+++
components/wsrp/trunk/admin-gui/src/main/webapp/jsf/consumers/exports/exportDetail.xhtml 2010-09-07
21:59:31 UTC (rev 4076)
@@ -40,7 +40,7 @@
<tr>
<th>#{i18n.export_detail_portlets}</th>
<td>
- <h:dataTable id="exported-portlets"
value="#{consumer.currentExport.exportedPortletHandles}" var="handle"
+ <h:dataTable id="exported-portlets"
value="#{consumer.currentExport.exportedPortlets}" var="handle"
rowClasses="EvenRow,OddRow"
styleClass="UIGrid" width="100%">
<h:column>
@@ -54,19 +54,19 @@
<th>#{i18n.export_detail_failed}</th>
<td>
<h:dataTable id="failed-portlets"
-
value="#{consumer.currentExport.errorCodesToFailedPortletHandlesMapping.entries}"
- rendered="#{! empty
consumer.currentExport.errorCodesToFailedPortletHandlesMapping.entries}"
- var="entry" rowClasses="EvenRow,OddRow"
styleClass="UIGrid" width="100%">
+ value="#{consumer.currentExport.failedPortlets}"
+
rendered="#{consumer.currentExport.hasFailedPortlets}"
+ var="failedPortlet"
rowClasses="EvenRow,OddRow" styleClass="UIGrid"
width="100%">
<h:column>
<f:facet
name="header">#{i18n.export_detail_failed_portlet_error}</f:facet>
- #{entry.key}
+ #{failedPortlet.errorCode}
</h:column>
<h:column>
<f:facet
name="header">#{i18n.export_detail_failed_portlet_portlets}</f:facet>
- #{entry.value}
+ #{failedPortlet.failedPortlets}
</h:column>
</h:dataTable>
- <h:outputText rendered="#{empty
consumer.currentExport.errorCodesToFailedPortletHandlesMapping.entries}"
+ <h:outputText
rendered="#{!consumer.currentExport.hasFailedPortlets}"
value="#{i18n.export_detail_failed_portlet_none}"/>
</td>
</tr>
Modified:
components/wsrp/trunk/admin-gui/src/main/webapp/jsf/consumers/exports/exports.xhtml
===================================================================
---
components/wsrp/trunk/admin-gui/src/main/webapp/jsf/consumers/exports/exports.xhtml 2010-09-07
20:33:07 UTC (rev 4075)
+++
components/wsrp/trunk/admin-gui/src/main/webapp/jsf/consumers/exports/exports.xhtml 2010-09-07
21:59:31 UTC (rev 4076)
@@ -32,14 +32,35 @@
<h:dataTable id="exportsList"
value="#{consumer.existingExports}" var="export"
rowClasses="EvenRow,OddRow"
styleClass="UIGrid" width="100%">
<h:column>
- <f:facet
name="header">#{i18n.export_table_column_time}</f:facet>
+ <f:facet
name="header">#{i18n.export_detail_export_time}</f:facet>
#{export.exportTime}
</h:column>
<h:column>
- <f:facet
name="header">#{i18n.export_table_column_portlet_name}</f:facet>
- #{portlet.handle}
+ <f:facet
name="header">#{i18n.export_detail_expiration_time}</f:facet>
+ #{export.expirationTime}
</h:column>
+
+ <h:column>
+ <f:facet
name="header">#{i18n.export_detail_has_failed}</f:facet>
+ <h:selectBooleanCheckbox value="#{export.hasFailedPortlets}"
disabled="true"/>
+ </h:column>
+
+ <h:column>
+ <f:facet
name="header">#{i18n.exports_actions}</f:facet>
+
+ <h:commandLink action="#{consumer.viewExport}"
styleClass="actionConfigure" id="view">
+ #{i18n.exports_actions_view}
+ </h:commandLink>
+ |
+ <h:commandLink action="confirmDeleteExport"
actionListener="#{consumer.selectExport}" styleClass="actionDelete"
id="delete">
+ #{i18n.exports_actions_delete}
+ </h:commandLink>
+ |
+ <h:commandLink action="#{consumer.importPortlets}"
styleClass="actionUse" id="use">
+ #{i18n.exports_actions_use}
+ </h:commandLink>
+ </h:column>
</h:dataTable>
<table class="ActionContainer">
<tr>
@@ -47,8 +68,7 @@
<div class="ButtonLeft">
<div class="ButtonRight">
<div class="ButtonMiddle">
- <h:commandButton id="exportButton"
action="#{consumer.export}"
-
value="#{i18n.export_table_export}"/>
+ <h:commandButton id="consumers"
action="consumers" value="#{i18n.export_detail_consumers}"/>
</div>
</div>
</div>
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/WSRPConsumer.java
===================================================================
---
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/WSRPConsumer.java 2010-09-07
20:33:07 UTC (rev 4075)
+++
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/WSRPConsumer.java 2010-09-07
21:59:31 UTC (rev 4076)
@@ -130,4 +130,6 @@
ExportInfo exportPortlets(List<String> portletHandles) throws
PortletInvokerException;
MigrationService getMigrationService();
+
+ boolean isSupportsExport();
}
Modified:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/WSRPConsumerImpl.java
===================================================================
---
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/WSRPConsumerImpl.java 2010-09-07
20:33:07 UTC (rev 4075)
+++
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/WSRPConsumerImpl.java 2010-09-07
21:59:31 UTC (rev 4076)
@@ -509,6 +509,19 @@
return supportedUserScopes.contains(userScope);
}
+ public boolean isSupportsExport()
+ {
+ try
+ {
+ return getMarkupService().getVersion() > 1;
+ }
+ catch (PortletInvokerException e)
+ {
+ log.debug("Couldn't determine if Consumer supports export
operation", e);
+ return false;
+ }
+ }
+
// Registration
*****************************************************************************************************
public void handleInvalidRegistrationFault() throws PortletInvokerException
Modified:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/migration/ExportInfo.java
===================================================================
---
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/migration/ExportInfo.java 2010-09-07
20:33:07 UTC (rev 4075)
+++
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/migration/ExportInfo.java 2010-09-07
21:59:31 UTC (rev 4076)
@@ -26,9 +26,12 @@
import org.gatein.common.util.ParameterValidation;
import javax.xml.namespace.QName;
+import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.Date;
import java.util.List;
+import java.util.Locale;
import java.util.SortedMap;
import java.util.TreeMap;
@@ -72,11 +75,30 @@
return exportTime;
}
+ public String getHumanReadableExportTime(Locale locale)
+ {
+ return getHumanReadableTime(locale, exportTime);
+ }
+
public long getExpirationTime()
{
return expirationTime;
}
+ public String getHumanReadableExpirationTime(Locale locale)
+ {
+ return getHumanReadableTime(locale, expirationTime);
+ }
+
+ private String getHumanReadableTime(Locale locale, final long time)
+ {
+ if(locale == null)
+ {
+ locale = Locale.getDefault();
+ }
+ return DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL,
locale).format(new Date(time));
+ }
+
public List<String> getExportedPortletHandles()
{
return new ArrayList<String>(handleToExportedState.keySet());
Modified:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/migration/MigrationService.java
===================================================================
---
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/migration/MigrationService.java 2010-09-07
20:33:07 UTC (rev 4075)
+++
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/migration/MigrationService.java 2010-09-07
21:59:31 UTC (rev 4076)
@@ -68,4 +68,9 @@
}
return exportInfos;
}
+
+ public boolean isAvailableExportInfosEmpty()
+ {
+ return exportInfos == null || exportInfos.isEmpty();
+ }
}
Added:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/migration/MigrationServiceTestCase.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/migration/MigrationServiceTestCase.java
(rev 0)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/migration/MigrationServiceTestCase.java 2010-09-07
21:59:31 UTC (rev 4076)
@@ -0,0 +1,62 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.wsrp.consumer.migration;
+
+import junit.framework.TestCase;
+
+import java.util.List;
+import java.util.TreeMap;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ */
+public class MigrationServiceTestCase extends TestCase
+{
+ private MigrationService service;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ service = new MigrationService();
+ }
+
+ public void testIsAvailableExportInfosEmpty()
+ {
+ assertTrue(service.isAvailableExportInfosEmpty());
+ }
+
+ public void testAddExport()
+ {
+ ExportInfo info = new ExportInfo(System.currentTimeMillis(), new TreeMap<String,
byte[]>(), null);
+ service.add(info);
+
+ List<ExportInfo> exports = service.getAvailableExportInfos();
+ assertNotNull(exports);
+ assertEquals(1, exports.size());
+ assertEquals(info, exports.get(0));
+ assertEquals(info, service.getExportInfo(info.getExportTime()));
+ assertFalse(service.isAvailableExportInfosEmpty());
+ }
+}
Modified:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/support/MockWSRPConsumer.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/support/MockWSRPConsumer.java 2010-09-07
20:33:07 UTC (rev 4075)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/support/MockWSRPConsumer.java 2010-09-07
21:59:31 UTC (rev 4076)
@@ -30,6 +30,7 @@
import org.gatein.pc.api.PortletStateType;
import org.gatein.pc.api.invocation.PortletInvocation;
import org.gatein.pc.api.invocation.response.PortletInvocationResponse;
+import org.gatein.pc.api.state.DestroyCloneFailure;
import org.gatein.pc.api.state.PropertyChange;
import org.gatein.pc.api.state.PropertyMap;
import org.gatein.wsrp.WSRPConsumer;
@@ -111,7 +112,7 @@
return null;
}
- public Set getPortlets() throws PortletInvokerException
+ public Set<Portlet> getPortlets() throws PortletInvokerException
{
return null;
}
@@ -131,7 +132,7 @@
return null;
}
- public List destroyClones(List portletContexts) throws IllegalArgumentException,
PortletInvokerException, UnsupportedOperationException
+ public List<DestroyCloneFailure> destroyClones(List<PortletContext>
portletContexts) throws IllegalArgumentException, PortletInvokerException,
UnsupportedOperationException
{
return null;
}
@@ -173,6 +174,11 @@
throw new NotYetImplemented();
}
+ public boolean isSupportsExport()
+ {
+ return false;
+ }
+
public void destroy()
{
}