You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2012/02/23 17:38:04 UTC

svn commit: r1292848 [2/3] - in /incubator/syncope/trunk: archetype/src/main/resources/archetype-resources/ archetype/src/main/resources/archetype-resources/console/ archetype/src/main/resources/archetype-resources/core/ client/ client/src/main/java/or...

Added: incubator/syncope/trunk/console/src/main/java/org/syncope/console/markup/html/CrontabContainer.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/syncope/console/markup/html/CrontabContainer.java?rev=1292848&view=auto
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/syncope/console/markup/html/CrontabContainer.java (added)
+++ incubator/syncope/trunk/console/src/main/java/org/syncope/console/markup/html/CrontabContainer.java Thu Feb 23 16:38:01 2012
@@ -0,0 +1,226 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.syncope.console.markup.html;
+
+import java.util.Arrays;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.form.DropDownChoice;
+import org.apache.wicket.markup.html.form.FormComponent;
+import org.apache.wicket.markup.html.form.TextField;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.model.PropertyModel;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.syncope.console.commons.SelectChoiceRenderer;
+import org.syncope.console.commons.SelectOption;
+
+public class CrontabContainer extends WebMarkupContainer {
+
+    /**
+     * Logger.
+     */
+    protected static final Logger LOG = LoggerFactory.getLogger(
+            CrontabContainer.class);
+
+    private static final SelectOption[] CRON_TEMPLATES = new SelectOption[]{
+        new SelectOption(
+        "Unschedule", "UNSCHEDULE"),
+        new SelectOption(
+        "Every 5 minutes", "0 0/5 * * * ?"),
+        new SelectOption(
+        "Fire at 12pm (noon) every day", "0 0 12 * * ?"),
+        new SelectOption(
+        "Fire at 12am (midnight) every first day of the month", "0 0 0 1 * ?"),
+        new SelectOption(
+        "Fire at 12am (midnight) every last day of the month", "0 0 0 L * ?"),
+        new SelectOption(
+        "Fire at 12am (midnight) every Monday", "0 0 0 ? * 2")
+    };
+
+    private static final long serialVersionUID = 7879593326085337650L;
+
+    private final TextField seconds;
+
+    private final TextField minutes;
+
+    private final TextField hours;
+
+    private final TextField daysOfMonth;
+
+    private final TextField months;
+
+    private final TextField daysOfWeek;
+
+    public CrontabContainer(final String id,
+            final PropertyModel<String> cronExpressionModel,
+            final String cronExpression) {
+
+        super(id);
+        setOutputMarkupId(true);
+
+        final DropDownChoice<SelectOption> cronTemplateChooser =
+                new DropDownChoice("cronTemplateChooser") {
+
+                    private static final long serialVersionUID =
+                            -5843424545478691442L;
+
+                    @Override
+                    protected CharSequence getDefaultChoice(
+                            final String selected) {
+
+                        return "<option value=\"\">"
+                                + getString("chooseForTemplate")
+                                + "</option>";
+                    }
+                };
+        cronTemplateChooser.setModel(new IModel<SelectOption>() {
+
+            private static final long serialVersionUID = 6762568283146531315L;
+
+            @Override
+            public SelectOption getObject() {
+                SelectOption result = null;
+                for (SelectOption so : CRON_TEMPLATES) {
+                    if (so.getKeyValue().equals(
+                            cronExpressionModel.getObject())) {
+
+                        result = so;
+                    }
+                }
+
+                return result;
+            }
+
+            @Override
+            public void setObject(final SelectOption object) {
+                cronExpressionModel.setObject(
+                        object == null || object.equals(CRON_TEMPLATES[0])
+                        ? null : object.toString());
+            }
+
+            @Override
+            public void detach() {
+            }
+        });
+        cronTemplateChooser.setChoices(Arrays.asList(CRON_TEMPLATES));
+        cronTemplateChooser.setChoiceRenderer(new SelectChoiceRenderer());
+        add(cronTemplateChooser);
+
+        seconds = new TextField("seconds",
+                new Model(getCronField(cronExpression, 0)));
+        add(seconds);
+
+        minutes = new TextField("minutes",
+                new Model(getCronField(cronExpression, 1)));
+        add(minutes);
+
+        hours = new TextField("hours",
+                new Model(getCronField(cronExpression, 2)));
+        add(hours);
+
+        daysOfMonth = new TextField("daysOfMonth",
+                new Model(getCronField(cronExpression, 3)));
+        add(daysOfMonth);
+
+        months = new TextField("months",
+                new Model(getCronField(cronExpression, 4)));
+        add(months);
+
+        daysOfWeek = new TextField("daysOfWeek",
+                new Model(getCronField(cronExpression, 5)));
+        add(daysOfWeek);
+
+        cronTemplateChooser.add(
+                new AjaxFormComponentUpdatingBehavior("onchange") {
+
+                    private static final long serialVersionUID =
+                            -1107858522700306810L;
+
+                    @Override
+                    protected void onUpdate(final AjaxRequestTarget target) {
+                        seconds.setModelObject(
+                                getCronField(cronTemplateChooser, 0));
+                        minutes.setModelObject(
+                                getCronField(cronTemplateChooser, 1));
+                        hours.setModelObject(
+                                getCronField(cronTemplateChooser, 2));
+                        daysOfMonth.setModelObject(
+                                getCronField(cronTemplateChooser, 3));
+                        months.setModelObject(
+                                getCronField(cronTemplateChooser, 4));
+                        daysOfWeek.setModelObject(
+                                getCronField(cronTemplateChooser, 5));
+                        target.add(CrontabContainer.this);
+                    }
+                });
+    }
+
+    private String getCronField(final FormComponent formComponent,
+            final int field) {
+
+        String cronField = null;
+
+        if (formComponent != null) {
+            cronField = getCronField(formComponent.getInput(), field);
+        }
+
+        return cronField;
+    }
+
+    private String getCronField(final String cron, final int field) {
+        String cronField = null;
+
+        if (cron != null && !cron.isEmpty() && !"UNSCHEDULE".equals(cron)) {
+            cronField = cron.split(" ")[field].trim();
+        }
+
+        return cronField;
+    }
+
+    public String getCronExpression() {
+        String cronExpression = null;
+
+        if (seconds != null && seconds.getInput() != null
+                && minutes != null && minutes.getInput() != null
+                && hours != null && hours.getInput() != null
+                && daysOfMonth != null && daysOfMonth.getInput() != null
+                && months != null && months.getInput() != null
+                && daysOfWeek != null && daysOfWeek.getInput() != null) {
+
+            cronExpression = new StringBuilder().append(
+                    seconds.getInput().trim()).
+                    append(" ").
+                    append(minutes.getInput().trim()).
+                    append(" ").
+                    append(hours.getInput().trim()).
+                    append(" ").
+                    append(daysOfMonth.getInput().trim()).
+                    append(" ").
+                    append(months.getInput().trim()).
+                    append(" ").
+                    append(daysOfWeek.getInput().trim()).
+                    toString();
+        }
+
+        return cronExpression;
+    }
+}

Modified: incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/AbstractSchedTaskModalPage.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/AbstractSchedTaskModalPage.java?rev=1292848&r1=1292847&r2=1292848&view=diff
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/AbstractSchedTaskModalPage.java (original)
+++ incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/AbstractSchedTaskModalPage.java Thu Feb 23 16:38:01 2012
@@ -18,29 +18,20 @@
  */
 package org.syncope.console.pages;
 
-import java.util.Arrays;
-import java.util.Date;
 import org.apache.wicket.PageReference;
 import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
 import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy;
 import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxButton;
 import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.form.DropDownChoice;
 import org.apache.wicket.markup.html.form.Form;
-import org.apache.wicket.markup.html.form.TextField;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.Model;
 import org.apache.wicket.model.PropertyModel;
 import org.apache.wicket.model.ResourceModel;
 import org.springframework.util.StringUtils;
 import org.syncope.client.to.SchedTaskTO;
 import org.syncope.client.to.SyncTaskTO;
 import org.syncope.client.validation.SyncopeClientCompositeErrorException;
-import org.syncope.console.SyncopeSession;
-import org.syncope.console.commons.SelectChoiceRenderer;
-import org.syncope.console.commons.SelectOption;
+import org.syncope.console.commons.DateFormatROModel;
+import org.syncope.console.markup.html.CrontabContainer;
 import org.syncope.console.wicket.markup.html.form.AjaxTextFieldPanel;
 
 /**
@@ -50,22 +41,7 @@ public abstract class AbstractSchedTaskM
 
     private static final long serialVersionUID = 2892005971093059242L;
 
-    public static final SelectOption[] CRON_TEMPLATES = new SelectOption[]{
-        new SelectOption(
-        "Unschedule", "UNSCHEDULE"),
-        new SelectOption(
-        "Every 5 minutes", "0 0/5 * * * ?"),
-        new SelectOption(
-        "Fire at 12pm (noon) every day", "0 0 12 * * ?"),
-        new SelectOption(
-        "Fire at 12am (midnight) every first day of the month", "0 0 0 1 * ?"),
-        new SelectOption(
-        "Fire at 12am (midnight) every Last day of the month", "0 0 0 L * ?"),
-        new SelectOption(
-        "Fire at 12am (midnight) every Monday", "0 0 0 ? * 2")
-    };
-
-    protected WebMarkupContainer crontab;
+    protected CrontabContainer crontab;
 
     public AbstractSchedTaskModalPage(
             final ModalWindow window,
@@ -74,8 +50,9 @@ public abstract class AbstractSchedTaskM
 
         super(taskTO);
 
-        crontab = new WebMarkupContainer("crontab");
-        crontab.setOutputMarkupId(true);
+        crontab = new CrontabContainer("crontab",
+                new PropertyModel<String>(taskTO, "cronExpression"),
+                taskTO.getCronExpression());
         form.add(crontab);
 
         final AjaxTextFieldPanel lastExec = new AjaxTextFieldPanel(
@@ -90,78 +67,6 @@ public abstract class AbstractSchedTaskM
         nextExec.setEnabled(false);
         profile.add(nextExec);
 
-        final DropDownChoice<String> cronTemplateChooser = new DropDownChoice(
-                "cronTemplateChooser",
-                new PropertyModel(taskTO, "cronExpression"),
-                Arrays.asList(CRON_TEMPLATES),
-                new SelectChoiceRenderer()) {
-
-            private static final long serialVersionUID = -5843424545478691442L;
-
-            @Override
-            protected CharSequence getDefaultChoice(final String selected) {
-                return "<option value=\"\">"
-                        + getString("chooseForTemplate")
-                        + "</option>";
-            }
-        };
-
-        final TextField seconds = new TextField(
-                "seconds",
-                new Model(getCronField(taskTO.getCronExpression(), 0)));
-        crontab.add(seconds);
-
-        final TextField minutes = new TextField(
-                "minutes",
-                new Model(getCronField(taskTO.getCronExpression(), 1)));
-        crontab.add(minutes);
-
-        final TextField hours = new TextField(
-                "hours",
-                new Model(getCronField(taskTO.getCronExpression(), 2)));
-        crontab.add(hours);
-
-        final TextField daysOfMonth = new TextField(
-                "daysOfMonth",
-                new Model(getCronField(taskTO.getCronExpression(), 3)));
-        crontab.add(daysOfMonth);
-
-        final TextField months = new TextField(
-                "months",
-                new Model(getCronField(taskTO.getCronExpression(), 4)));
-        crontab.add(months);
-
-        final TextField daysOfWeek = new TextField(
-                "daysOfWeek",
-                new Model(getCronField(taskTO.getCronExpression(), 5)));
-        crontab.add(daysOfWeek);
-
-        cronTemplateChooser.add(
-                new AjaxFormComponentUpdatingBehavior("onchange") {
-
-                    private static final long serialVersionUID =
-                            -1107858522700306810L;
-
-                    @Override
-                    protected void onUpdate(final AjaxRequestTarget target) {
-                        seconds.setModelObject(
-                                getCronField(cronTemplateChooser, 0));
-                        minutes.setModelObject(
-                                getCronField(cronTemplateChooser, 1));
-                        hours.setModelObject(
-                                getCronField(cronTemplateChooser, 2));
-                        daysOfMonth.setModelObject(
-                                getCronField(cronTemplateChooser, 3));
-                        months.setModelObject(
-                                getCronField(cronTemplateChooser, 4));
-                        daysOfWeek.setModelObject(
-                                getCronField(cronTemplateChooser, 5));
-                        target.add(crontab);
-                    }
-                });
-
-        crontab.add(cronTemplateChooser);
-
         final IndicatingAjaxButton submit = new IndicatingAjaxButton(
                 "apply", new ResourceModel("apply")) {
 
@@ -173,36 +78,26 @@ public abstract class AbstractSchedTaskM
                     final Form form) {
 
                 SchedTaskTO taskTO = (SchedTaskTO) form.getModelObject();
-                if (!StringUtils.hasText(taskTO.getCronExpression())
-                        || "UNSCHEDULE".equals(taskTO.getCronExpression())) {
-                    taskTO.setCronExpression(null);
-                } else {
-                    taskTO.setCronExpression(getCron(
-                            seconds, minutes, hours,
-                            daysOfMonth, months, daysOfWeek));
-                }
+                taskTO.setCronExpression(
+                        !StringUtils.hasText(taskTO.getCronExpression())
+                        ? null : crontab.getCronExpression());
 
                 try {
                     if (taskTO.getId() > 0) {
-                        // update task
                         if (taskTO instanceof SyncTaskTO) {
-                            taskTO = taskRestClient.updateSyncTask(
-                                    (SyncTaskTO) taskTO);
+                            taskRestClient.updateSyncTask((SyncTaskTO) taskTO);
                         } else {
-                            taskTO = taskRestClient.updateSchedTask(taskTO);
+                            taskRestClient.updateSchedTask(taskTO);
                         }
                     } else {
                         if (taskTO instanceof SyncTaskTO) {
-                            // create task
-                            taskTO = taskRestClient.createSyncTask(
-                                    (SyncTaskTO) taskTO);
+                            taskRestClient.createSyncTask((SyncTaskTO) taskTO);
                         } else {
-                            taskTO = taskRestClient.createSchedTask(taskTO);
+                            taskRestClient.createSchedTask(taskTO);
                         }
                     }
 
-                    ((BasePage) callerPageRef.getPage()).setModalResult(
-                            true);
+                    ((BasePage) callerPageRef.getPage()).setModalResult(true);
 
                     window.close(target);
                 } catch (SyncopeClientCompositeErrorException e) {
@@ -231,30 +126,4 @@ public abstract class AbstractSchedTaskM
 
         form.add(submit);
     }
-
-    private static class DateFormatROModel implements IModel<String> {
-
-        private static final long serialVersionUID = 6677274580927636121L;
-
-        private final PropertyModel model;
-
-        public DateFormatROModel(final PropertyModel model) {
-            this.model = model;
-        }
-
-        @Override
-        public String getObject() {
-            return model.getObject() == null
-                    ? "" : SyncopeSession.get().getDateFormat().
-                    format((Date) model.getObject());
-        }
-
-        @Override
-        public void setObject(final String object) {
-        }
-
-        @Override
-        public void detach() {
-        }
-    }
 }

Modified: incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/Configuration.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/Configuration.java?rev=1292848&r1=1292847&r2=1292848&view=diff
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/Configuration.java (original)
+++ incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/Configuration.java Thu Feb 23 16:38:01 2012
@@ -18,6 +18,8 @@
  */
 package org.syncope.console.pages;
 
+import ch.qos.logback.classic.Logger;
+import ch.qos.logback.classic.LoggerContext;
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -29,6 +31,7 @@ import org.apache.wicket.ajax.AjaxReques
 import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
 import org.apache.wicket.ajax.markup.html.AjaxLink;
 import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy;
+import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxButton;
 import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
 import org.apache.wicket.extensions.ajax.markup.html.repeater.data.table.AjaxFallbackDefaultDataTable;
 import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator;
@@ -41,42 +44,40 @@ import org.apache.wicket.markup.html.Web
 import org.apache.wicket.markup.html.basic.Label;
 import org.apache.wicket.markup.html.form.DropDownChoice;
 import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.markup.html.form.TextArea;
+import org.apache.wicket.markup.html.link.Link;
 import org.apache.wicket.markup.html.list.ListItem;
 import org.apache.wicket.markup.html.list.PropertyListView;
 import org.apache.wicket.markup.repeater.Item;
 import org.apache.wicket.model.AbstractReadOnlyModel;
+import org.apache.wicket.model.CompoundPropertyModel;
 import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.Model;
 import org.apache.wicket.model.PropertyModel;
 import org.apache.wicket.model.ResourceModel;
+import org.apache.wicket.request.handler.resource.ResourceStreamRequestHandler;
 import org.apache.wicket.request.mapper.parameter.PageParameters;
+import org.apache.wicket.request.resource.ContentDisposition;
 import org.apache.wicket.spring.injection.annot.SpringBean;
 import org.slf4j.LoggerFactory;
+import org.springframework.web.client.RestTemplate;
 import org.syncope.client.to.ConfigurationTO;
 import org.syncope.client.to.LoggerTO;
+import org.syncope.client.to.NotificationTO;
+import org.syncope.client.to.WorkflowDefinitionTO;
+import org.syncope.client.validation.SyncopeClientCompositeErrorException;
 import org.syncope.console.commons.Constants;
+import org.syncope.console.commons.HttpResourceStream;
 import org.syncope.console.commons.PreferenceManager;
 import org.syncope.console.commons.SortableDataProviderComparator;
-import org.syncope.console.rest.ConfigurationRestClient;
-import ch.qos.logback.classic.Logger;
-import ch.qos.logback.classic.LoggerContext;
 import org.syncope.console.pages.panels.PoliciesPanel;
-import org.syncope.types.PolicyType;
-import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxButton;
-import org.apache.wicket.markup.html.form.TextArea;
-import org.apache.wicket.markup.html.link.Link;
-import org.apache.wicket.model.CompoundPropertyModel;
-import org.apache.wicket.model.Model;
-import org.apache.wicket.request.handler.resource.ResourceStreamRequestHandler;
-import org.apache.wicket.request.resource.ContentDisposition;
-import org.apache.wicket.util.resource.StringResourceStream;
-import org.syncope.client.to.NotificationTO;
-import org.syncope.client.to.WorkflowDefinitionTO;
-import org.syncope.client.validation.SyncopeClientCompositeErrorException;
+import org.syncope.console.rest.ConfigurationRestClient;
 import org.syncope.console.rest.NotificationRestClient;
 import org.syncope.console.rest.WorkflowRestClient;
 import org.syncope.console.wicket.markup.html.form.ActionLink;
 import org.syncope.console.wicket.markup.html.form.ActionLinksPanel;
 import org.syncope.types.LoggerLevel;
+import org.syncope.types.PolicyType;
 
 /**
  * Configurations WebPage.
@@ -95,6 +96,12 @@ public class Configuration extends BaseP
     private WorkflowRestClient wfRestClient;
 
     @SpringBean
+    private RestTemplate restTemplate;
+
+    @SpringBean(name = "baseURL")
+    protected String baseURL;
+
+    @SpringBean
     private PreferenceManager prefMan;
 
     private final ModalWindow createConfigWin;
@@ -371,13 +378,20 @@ public class Configuration extends BaseP
 
             @Override
             public void onClick() {
-                StringResourceStream stream =
-                        new StringResourceStream(
-                        confRestClient.dbContentAsXml(), "text/xml");
-                getRequestCycle().scheduleRequestHandlerAfterCurrent(
-                        new ResourceStreamRequestHandler(stream).setFileName(
-                        "content.xml").setContentDisposition(
-                        ContentDisposition.ATTACHMENT));
+                try {
+                    HttpResourceStream stream = new HttpResourceStream(
+                            baseURL + "configuration/dbexport", restTemplate);
+
+                    ResourceStreamRequestHandler rsrh =
+                            new ResourceStreamRequestHandler(stream);
+                    rsrh.setFileName(stream.getFilename() == null
+                            ? "content.xml" : stream.getFilename());
+                    rsrh.setContentDisposition(ContentDisposition.ATTACHMENT);
+
+                    getRequestCycle().scheduleRequestHandlerAfterCurrent(rsrh);
+                } catch (Exception e) {
+                    error(getString("error") + ": " + e.getMessage());
+                }
             }
         };
 

Added: incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/ExecMessageModalPage.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/ExecMessageModalPage.java?rev=1292848&view=auto
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/ExecMessageModalPage.java (added)
+++ incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/ExecMessageModalPage.java Thu Feb 23 16:38:01 2012
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.syncope.console.pages;
+
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.model.Model;
+
+public class ExecMessageModalPage extends BaseModalPage {
+
+    private static final long serialVersionUID = 3163146190501510888L;
+
+    public ExecMessageModalPage(final String message) {
+        final Label dialogContent =
+                new Label("message", new Model<String>(message));
+        add(dialogContent.setOutputMarkupId(true));
+    }
+}

Propchange: incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/ExecMessageModalPage.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/ExecMessageModalPage.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/ExecMessageModalPage.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/ReportExecResultDownloadModalPage.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/ReportExecResultDownloadModalPage.java?rev=1292848&view=auto
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/ReportExecResultDownloadModalPage.java (added)
+++ incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/ReportExecResultDownloadModalPage.java Thu Feb 23 16:38:01 2012
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.syncope.console.pages;
+
+import java.util.Arrays;
+import org.apache.wicket.PageReference;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
+import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
+import org.apache.wicket.markup.html.form.IChoiceRenderer;
+import org.apache.wicket.model.Model;
+import org.syncope.console.wicket.markup.html.form.AjaxDropDownChoicePanel;
+import org.syncope.types.ReportExecExportFormat;
+
+public class ReportExecResultDownloadModalPage extends BaseModalPage {
+
+    private static final long serialVersionUID = 3163146190501510888L;
+
+    public ReportExecResultDownloadModalPage(final ModalWindow window,
+            final PageReference callerPageRef) {
+
+        final AjaxDropDownChoicePanel<ReportExecExportFormat> format =
+                new AjaxDropDownChoicePanel<ReportExecExportFormat>(
+                "format", "format", new Model<ReportExecExportFormat>(), false);
+
+        format.setChoices(Arrays.asList(ReportExecExportFormat.values()));
+
+        format.setChoiceRenderer(new IChoiceRenderer<ReportExecExportFormat>() {
+
+            private static final long serialVersionUID = -3941271550163141339L;
+
+            @Override
+            public Object getDisplayValue(final ReportExecExportFormat object) {
+                return object.name();
+            }
+
+            @Override
+            public String getIdValue(final ReportExecExportFormat object,
+                    final int index) {
+
+                return object.name();
+            }
+        });
+
+        format.getField().add(new AjaxFormComponentUpdatingBehavior(
+                "onchange") {
+
+            private static final long serialVersionUID =
+                    -1107858522700306810L;
+
+            @Override
+            protected void onUpdate(final AjaxRequestTarget target) {
+                ((ReportModalPage) callerPageRef.getPage()).setExportFormat(
+                        format.getField().getInput());
+                window.close(target);
+            }
+        });
+        add(format);
+    }
+}

Propchange: incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/ReportExecResultDownloadModalPage.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/ReportExecResultDownloadModalPage.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/ReportExecResultDownloadModalPage.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/ReportModalPage.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/ReportModalPage.java?rev=1292848&view=auto
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/ReportModalPage.java (added)
+++ incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/ReportModalPage.java Thu Feb 23 16:38:01 2012
@@ -0,0 +1,453 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.syncope.console.pages;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import org.apache.wicket.Page;
+import org.apache.wicket.PageReference;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy;
+import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxButton;
+import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
+import org.apache.wicket.extensions.ajax.markup.html.repeater.data.table.AjaxFallbackDefaultDataTable;
+import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator;
+import org.apache.wicket.extensions.markup.html.repeater.data.sort.SortOrder;
+import org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn;
+import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
+import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn;
+import org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.markup.repeater.Item;
+import org.apache.wicket.model.AbstractReadOnlyModel;
+import org.apache.wicket.model.CompoundPropertyModel;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.PropertyModel;
+import org.apache.wicket.model.ResourceModel;
+import org.apache.wicket.spring.injection.annot.SpringBean;
+import org.apache.wicket.util.resource.IResourceStream;
+import org.springframework.util.StringUtils;
+import org.springframework.web.client.RestTemplate;
+import org.syncope.client.to.ReportExecTO;
+import org.syncope.client.to.ReportTO;
+import org.syncope.client.validation.SyncopeClientCompositeErrorException;
+import org.syncope.console.commons.DateFormatROModel;
+import org.syncope.console.commons.HttpResourceStream;
+import org.syncope.console.commons.SortableDataProviderComparator;
+import org.syncope.console.markup.html.CrontabContainer;
+import org.syncope.console.rest.ReportRestClient;
+import org.syncope.console.wicket.ajax.form.AbstractAjaxDownloadBehavior;
+import org.syncope.console.wicket.extensions.markup.html.repeater.data.table.DatePropertyColumn;
+import org.syncope.console.wicket.markup.html.form.ActionLink;
+import org.syncope.console.wicket.markup.html.form.ActionLinksPanel;
+import org.syncope.console.wicket.markup.html.form.AjaxTextFieldPanel;
+import org.syncope.types.ReportExecStatus;
+
+public class ReportModalPage extends BaseModalPage {
+
+    private static final long serialVersionUID = -5747628615211127644L;
+
+    private static final int EXEC_EXPORT_WIN_HEIGHT = 100;
+
+    private static final int EXEC_EXPORT_WIN_WIDTH = 400;
+
+    @SpringBean
+    private ReportRestClient restClient;
+
+    @SpringBean
+    protected RestTemplate restTemplate;
+
+    @SpringBean(name = "baseURL")
+    protected String baseURL;
+
+    private final ReportTO reportTO;
+
+    private Form<ReportTO> form;
+
+    private String exportFormat;
+
+    private long exportExecId;
+
+    public ReportModalPage(final ModalWindow window, final ReportTO reportTO,
+            final PageReference callerPageRef) {
+
+        this.reportTO = reportTO;
+
+        form = new Form<ReportTO>("form");
+        form.setModel(new CompoundPropertyModel(reportTO));
+        add(form);
+
+        setupProfile();
+        setupExecutions();
+
+        final CrontabContainer crontab = new CrontabContainer("crontab",
+                new PropertyModel<String>(reportTO, "cronExpression"),
+                reportTO.getCronExpression());
+        form.add(crontab);
+
+        final IndicatingAjaxButton submit = new IndicatingAjaxButton(
+                "apply", new ResourceModel("apply")) {
+
+            private static final long serialVersionUID = -958724007591692537L;
+
+            @Override
+            protected void onSubmit(
+                    final AjaxRequestTarget target,
+                    final Form form) {
+
+                ReportTO reportTO = (ReportTO) form.getModelObject();
+                reportTO.setCronExpression(
+                        StringUtils.hasText(reportTO.getCronExpression())
+                        ? crontab.getCronExpression() : null);
+
+                try {
+                    if (reportTO.getId() > 0) {
+                        restClient.update(reportTO);
+                    } else {
+                        restClient.create(reportTO);
+                    }
+
+                    ((BasePage) callerPageRef.getPage()).setModalResult(true);
+
+                    window.close(target);
+                } catch (SyncopeClientCompositeErrorException e) {
+                    LOG.error("While creating or updating report", e);
+                    error(getString("error") + ":" + e.getMessage());
+                    target.add(feedbackPanel);
+                }
+            }
+
+            @Override
+            protected void onError(final AjaxRequestTarget target,
+                    final Form form) {
+
+                target.add(feedbackPanel);
+            }
+        };
+
+
+        if (reportTO.getId() > 0) {
+            MetaDataRoleAuthorizationStrategy.authorize(submit, RENDER,
+                    xmlRolesReader.getAllAllowedRoles("Reports", "update"));
+        } else {
+            MetaDataRoleAuthorizationStrategy.authorize(submit, RENDER,
+                    xmlRolesReader.getAllAllowedRoles("Reports", "create"));
+        }
+
+        form.add(submit);
+    }
+
+    private void setupProfile() {
+        WebMarkupContainer profile = new WebMarkupContainer("profile");
+        profile.setOutputMarkupId(true);
+        form.add(profile);
+
+        final Label idLabel = new Label("idLabel", new ResourceModel("id"));
+        profile.add(idLabel);
+
+        final AjaxTextFieldPanel id = new AjaxTextFieldPanel(
+                "id", getString("id"),
+                new PropertyModel<String>(reportTO, "id"), false);
+
+        id.setEnabled(false);
+        profile.add(id);
+
+        final Label nameLabel =
+                new Label("nameLabel", new ResourceModel("name"));
+        profile.add(nameLabel);
+
+        final AjaxTextFieldPanel name = new AjaxTextFieldPanel(
+                "name", getString("name"),
+                new PropertyModel<String>(reportTO, "name"), false);
+
+        name.setEnabled(false);
+        profile.add(name);
+
+        final AjaxTextFieldPanel lastExec = new AjaxTextFieldPanel(
+                "lastExec", getString("lastExec"), new DateFormatROModel(
+                new PropertyModel<String>(reportTO, "lastExec")), false);
+        lastExec.setEnabled(false);
+        profile.add(lastExec);
+
+        final AjaxTextFieldPanel nextExec = new AjaxTextFieldPanel(
+                "nextExec", getString("nextExec"), new DateFormatROModel(
+                new PropertyModel<String>(reportTO, "nextExec")), false);
+        nextExec.setEnabled(false);
+        profile.add(nextExec);
+    }
+
+    private void setupExecutions() {
+        final WebMarkupContainer executions =
+                new WebMarkupContainer("executions");
+        executions.setOutputMarkupId(true);
+        form.add(executions);
+
+        final ModalWindow reportExecMessageWin = new ModalWindow(
+                "reportExecMessageWin");
+        reportExecMessageWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
+        reportExecMessageWin.setCookieName("report-exec-message-win-modal");
+        add(reportExecMessageWin);
+
+        final ModalWindow reportExecExportWin = new ModalWindow(
+                "reportExecExportWin");
+        reportExecExportWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
+        reportExecExportWin.setCookieName("report-exec-export-win-modal");
+        reportExecExportWin.setInitialHeight(EXEC_EXPORT_WIN_HEIGHT);
+        reportExecExportWin.setInitialWidth(EXEC_EXPORT_WIN_WIDTH);
+        reportExecExportWin.setWindowClosedCallback(
+                new ModalWindow.WindowClosedCallback() {
+
+                    private static final long serialVersionUID =
+                            8804221891699487139L;
+
+                    @Override
+                    public void onClose(final AjaxRequestTarget target) {
+                        AjaxExportDownloadBehavior behavior =
+                                new AjaxExportDownloadBehavior(
+                                ReportModalPage.this.exportFormat,
+                                ReportModalPage.this.exportExecId);
+                        executions.add(behavior);
+                        behavior.initiate(target);
+                    }
+                });
+        add(reportExecExportWin);
+
+        final List<IColumn> columns = new ArrayList<IColumn>();
+        columns.add(new PropertyColumn(new ResourceModel("id"), "id", "id"));
+        columns.add(new DatePropertyColumn(
+                new ResourceModel("startDate"), "startDate", "startDate"));
+        columns.add(new DatePropertyColumn(
+                new ResourceModel("endDate"), "endDate", "endDate"));
+        columns.add(new PropertyColumn(
+                new ResourceModel("status"), "status", "status"));
+        columns.add(new AbstractColumn<ReportExecTO>(
+                new ResourceModel("actions", "")) {
+
+            private static final long serialVersionUID = 2054811145491901166L;
+
+            @Override
+            public String getCssClass() {
+                return "action";
+            }
+
+            @Override
+            public void populateItem(
+                    final Item<ICellPopulator<ReportExecTO>> cellItem,
+                    final String componentId,
+                    final IModel<ReportExecTO> model) {
+
+                final ReportExecTO taskExecutionTO = model.getObject();
+
+                final ActionLinksPanel panel =
+                        new ActionLinksPanel(componentId, model);
+
+                panel.add(new ActionLink() {
+
+                    private static final long serialVersionUID =
+                            -3722207913631435501L;
+
+                    @Override
+                    public void onClick(final AjaxRequestTarget target) {
+                        reportExecMessageWin.setPageCreator(
+                                new ModalWindow.PageCreator() {
+
+                                    private static final long serialVersionUID =
+                                            -7834632442532690940L;
+
+                                    @Override
+                                    public Page createPage() {
+                                        return new ExecMessageModalPage(
+                                                model.getObject().getMessage());
+                                    }
+                                });
+                        reportExecMessageWin.show(target);
+                    }
+                }, ActionLink.ActionType.EDIT, "Reports", "read",
+                        StringUtils.hasText(model.getObject().getMessage()));
+
+                panel.add(new ActionLink() {
+
+                    private static final long serialVersionUID =
+                            -3722207913631435501L;
+
+                    @Override
+                    public void onClick(final AjaxRequestTarget target) {
+                        reportExecExportWin.setPageCreator(
+                                new ModalWindow.PageCreator() {
+
+                                    private static final long serialVersionUID =
+                                            -7834632442532690940L;
+
+                                    @Override
+                                    public Page createPage() {
+                                        ReportModalPage.this.exportExecId =
+                                                model.getObject().getId();
+                                        return new ReportExecResultDownloadModalPage(
+                                                reportExecExportWin,
+                                                ReportModalPage.this.
+                                                getPageReference());
+                                    }
+                                });
+                        reportExecExportWin.show(target);
+                    }
+                }, ActionLink.ActionType.EXPORT, "Reports", "read",
+                        ReportExecStatus.SUCCESS.name().equals(
+                        model.getObject().getStatus()));
+
+                panel.add(new ActionLink() {
+
+                    private static final long serialVersionUID =
+                            -3722207913631435501L;
+
+                    @Override
+                    public void onClick(final AjaxRequestTarget target) {
+                        try {
+                            restClient.deleteExecution(
+                                    taskExecutionTO.getId());
+
+                            reportTO.removeExecution(taskExecutionTO);
+
+                            info(getString("operation_succeded"));
+                        } catch (SyncopeClientCompositeErrorException scce) {
+                            error(scce.getMessage());
+                        }
+
+                        target.add(feedbackPanel);
+                        target.add(executions);
+                    }
+                }, ActionLink.ActionType.DELETE, "Reports", "delete");
+
+                cellItem.add(panel);
+            }
+        });
+
+        final AjaxFallbackDefaultDataTable table =
+                new AjaxFallbackDefaultDataTable("executionsTable", columns,
+                new ReportExecutionsProvider(reportTO), 10);
+        executions.add(table);
+    }
+
+    public void setExportFormat(final String exportFormat) {
+        this.exportFormat = exportFormat;
+    }
+
+    private class ReportExecutionsProvider
+            extends SortableDataProvider<ReportExecTO> {
+
+        private SortableDataProviderComparator<ReportExecTO> comparator;
+
+        private ReportTO reportTO;
+
+        public ReportExecutionsProvider(final ReportTO reportTO) {
+            this.reportTO = reportTO;
+            setSort("startDate", SortOrder.ASCENDING);
+            comparator = new SortableDataProviderComparator<ReportExecTO>(this);
+        }
+
+        @Override
+        public Iterator<ReportExecTO> iterator(final int first,
+                final int count) {
+
+            List<ReportExecTO> list = reportTO.getExecutions();
+
+            Collections.sort(list, comparator);
+
+            return list.subList(first, first + count).iterator();
+        }
+
+        @Override
+        public int size() {
+            return reportTO.getExecutions().size();
+        }
+
+        @Override
+        public IModel<ReportExecTO> model(
+                final ReportExecTO taskExecution) {
+
+            return new AbstractReadOnlyModel<ReportExecTO>() {
+
+                private static final long serialVersionUID =
+                        7485475149862342421L;
+
+                @Override
+                public ReportExecTO getObject() {
+                    return taskExecution;
+                }
+            };
+        }
+    }
+
+    private class AjaxExportDownloadBehavior
+            extends AbstractAjaxDownloadBehavior {
+
+        private static final long serialVersionUID =
+                3109256773218160485L;
+
+        private final String exportFormat;
+
+        private final long exportExecId;
+
+        private String url;
+
+        private HttpResourceStream stream;
+
+        public AjaxExportDownloadBehavior(final String exportFormat,
+                final long exportExecId) {
+
+            this.exportFormat = exportFormat;
+            this.exportExecId = exportExecId;
+        }
+
+        private void createResourceStream() {
+            StringBuilder urlBuilder = new StringBuilder();
+            urlBuilder.append(baseURL).
+                    append("report/execution/export/").append(exportExecId);
+            if (exportFormat != null) {
+                urlBuilder.append("?fmt=").append(exportFormat);
+            }
+
+            if (this.url != null && this.url.equals(urlBuilder.toString())) {
+                return;
+            }
+            this.url = urlBuilder.toString();
+
+            try {
+                stream = new HttpResourceStream(this.url, restTemplate);
+            } catch (Exception e) {
+                LOG.error("While contacting target URL", e);
+            }
+        }
+
+        @Override
+        protected String getFileName() {
+            createResourceStream();
+            return stream == null ? null : stream.getFilename();
+        }
+
+        @Override
+        protected IResourceStream getResourceStream() {
+            createResourceStream();
+            return stream;
+        }
+    }
+}

Modified: incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/Reports.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/Reports.java?rev=1292848&r1=1292847&r2=1292848&view=diff
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/Reports.java (original)
+++ incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/Reports.java Thu Feb 23 16:38:01 2012
@@ -18,16 +18,300 @@
  */
 package org.syncope.console.pages;
 
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import org.apache.wicket.Page;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
+import org.apache.wicket.ajax.markup.html.AjaxLink;
+import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy;
+import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxLink;
+import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
+import org.apache.wicket.extensions.ajax.markup.html.repeater.data.table.AjaxFallbackDefaultDataTable;
+import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator;
+import org.apache.wicket.extensions.markup.html.repeater.data.sort.SortOrder;
+import org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn;
+import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
+import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn;
+import org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.form.DropDownChoice;
+import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.markup.repeater.Item;
+import org.apache.wicket.model.AbstractReadOnlyModel;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.PropertyModel;
+import org.apache.wicket.model.ResourceModel;
 import org.apache.wicket.request.mapper.parameter.PageParameters;
+import org.apache.wicket.spring.injection.annot.SpringBean;
+import org.syncope.client.to.ReportTO;
+import org.syncope.client.validation.SyncopeClientCompositeErrorException;
+import org.syncope.console.commons.Constants;
+import org.syncope.console.commons.PreferenceManager;
+import org.syncope.console.commons.SortableDataProviderComparator;
+import org.syncope.console.rest.ReportRestClient;
+import org.syncope.console.wicket.extensions.markup.html.repeater.data.table.DatePropertyColumn;
+import org.syncope.console.wicket.markup.html.form.ActionLink;
+import org.syncope.console.wicket.markup.html.form.ActionLinksPanel;
 
 /**
- * Report WebPage.
+ * Auditing and Reporting.
  */
 public class Reports extends BasePage {
 
     private static final long serialVersionUID = -2071214196989178694L;
 
+    private static final int WIN_HEIGHT = 500;
+
+    private static final int WIN_WIDTH = 700;
+
+    @SpringBean
+    private ReportRestClient reportRestClient;
+
+    @SpringBean
+    private PreferenceManager prefMan;
+
+    private WebMarkupContainer reportContainer;
+
+    private int paginatorRows;
+
+    private final ModalWindow window;
+
     public Reports(final PageParameters parameters) {
         super(parameters);
+
+        window = new ModalWindow("reportWin");
+        window.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
+        window.setInitialHeight(WIN_HEIGHT);
+        window.setInitialWidth(WIN_WIDTH);
+        window.setCookieName("view-report-win");
+        add(window);
+
+        setupReport();
+    }
+
+    private void setupReport() {
+        reportContainer = new WebMarkupContainer("reportContainer");
+        setWindowClosedCallback(window, reportContainer);
+
+        MetaDataRoleAuthorizationStrategy.authorize(
+                reportContainer, RENDER,
+                xmlRolesReader.getAllAllowedRoles("Reports", "list"));
+
+        paginatorRows = prefMan.getPaginatorRows(getRequest(),
+                Constants.PREF_REPORT_PAGINATOR_ROWS);
+
+        List<IColumn> columns = new ArrayList<IColumn>();
+        columns.add(new PropertyColumn(new ResourceModel("id"),
+                "id", "id"));
+        columns.add(new PropertyColumn(new ResourceModel("name"),
+                "name", "name"));
+        columns.add(new DatePropertyColumn(
+                new ResourceModel("lastExec"), "lastExec", "lastExec"));
+        columns.add(new DatePropertyColumn(
+                new ResourceModel("nextExec"), "nextExec", "nextExec"));
+        columns.add(new PropertyColumn(
+                new ResourceModel("latestExecStatus"),
+                "latestExecStatus", "latestExecStatus"));
+        columns.add(new AbstractColumn<ReportTO>(
+                new ResourceModel("actions", "")) {
+
+            private static final long serialVersionUID = 2054811145491901166L;
+
+            @Override
+            public String getCssClass() {
+                return "action";
+            }
+
+            @Override
+            public void populateItem(
+                    final Item<ICellPopulator<ReportTO>> cellItem,
+                    final String componentId,
+                    final IModel<ReportTO> model) {
+
+                final ReportTO reportTO = model.getObject();
+
+                final ActionLinksPanel panel =
+                        new ActionLinksPanel(componentId, model);
+
+                panel.add(new ActionLink() {
+
+                    private static final long serialVersionUID =
+                            -3722207913631435501L;
+
+                    @Override
+                    public void onClick(final AjaxRequestTarget target) {
+
+                        window.setPageCreator(new ModalWindow.PageCreator() {
+
+                            private static final long serialVersionUID =
+                                    -7834632442532690940L;
+
+                            @Override
+                            public Page createPage() {
+                                return new ReportModalPage(
+                                        window, reportTO,
+                                        Reports.this.getPageReference());
+                            }
+                        });
+
+                        window.show(target);
+                    }
+                }, ActionLink.ActionType.EDIT, "Reports", "read");
+
+                panel.add(new ActionLink() {
+
+                    private static final long serialVersionUID =
+                            -3722207913631435501L;
+
+                    @Override
+                    public void onClick(final AjaxRequestTarget target) {
+                        try {
+                            reportRestClient.startExecution(reportTO.getId());
+                            getSession().info(getString("operation_succeded"));
+                        } catch (SyncopeClientCompositeErrorException scce) {
+                            error(scce.getMessage());
+                        }
+
+                        target.add(getPage().get("feedback"));
+                        target.add(reportContainer);
+                    }
+                }, ActionLink.ActionType.EXECUTE, "Reports", "execute");
+
+                panel.add(new ActionLink() {
+
+                    private static final long serialVersionUID =
+                            -3722207913631435501L;
+
+                    @Override
+                    public void onClick(final AjaxRequestTarget target) {
+                        try {
+                            reportRestClient.delete(reportTO.getId());
+                            info(getString("operation_succeded"));
+                        } catch (SyncopeClientCompositeErrorException scce) {
+                            error(scce.getMessage());
+                        }
+                        target.add(reportContainer);
+                        target.add(getPage().get("feedback"));
+                    }
+                }, ActionLink.ActionType.DELETE, "Reports", "delete");
+
+                cellItem.add(panel);
+            }
+        });
+
+        final AjaxFallbackDefaultDataTable reportTable =
+                new AjaxFallbackDefaultDataTable("reportTable", columns,
+                new ReportProvider(), paginatorRows);
+
+        reportContainer.add(reportTable);
+        reportContainer.setOutputMarkupId(true);
+
+        add(reportContainer);
+
+        Form paginatorForm = new Form("paginatorForm");
+
+        MetaDataRoleAuthorizationStrategy.authorize(
+                paginatorForm, RENDER,
+                xmlRolesReader.getAllAllowedRoles("Reports", "list"));
+
+        final DropDownChoice rowsChooser = new DropDownChoice("rowsChooser",
+                new PropertyModel(this, "paginatorRows"),
+                prefMan.getPaginatorChoices());
+
+        rowsChooser.add(new AjaxFormComponentUpdatingBehavior("onchange") {
+
+            private static final long serialVersionUID = -1107858522700306810L;
+
+            @Override
+            protected void onUpdate(final AjaxRequestTarget target) {
+                prefMan.set(getRequest(),
+                        getResponse(),
+                        Constants.PREF_REPORT_PAGINATOR_ROWS,
+                        String.valueOf(paginatorRows));
+                reportTable.setItemsPerPage(paginatorRows);
+
+                target.add(reportContainer);
+            }
+        });
+
+        paginatorForm.add(rowsChooser);
+        add(paginatorForm);
+
+        AjaxLink createLink = new IndicatingAjaxLink("createLink") {
+
+            private static final long serialVersionUID = -7978723352517770644L;
+
+            @Override
+            public void onClick(final AjaxRequestTarget target) {
+                window.setPageCreator(new ModalWindow.PageCreator() {
+
+                    private static final long serialVersionUID =
+                            -7834632442532690940L;
+
+                    @Override
+                    public Page createPage() {
+                        return new ReportModalPage(window, new ReportTO(),
+                                Reports.this.getPageReference());
+                    }
+                });
+
+                window.show(target);
+            }
+        };
+
+        MetaDataRoleAuthorizationStrategy.authorize(createLink, RENDER,
+                xmlRolesReader.getAllAllowedRoles("Reports", "create"));
+
+        add(createLink);
+    }
+
+    private class ReportProvider
+            extends SortableDataProvider<ReportTO> {
+
+        private static final long serialVersionUID = -2311716167583335852L;
+
+        private SortableDataProviderComparator<ReportTO> comparator;
+
+        public ReportProvider() {
+            //Default sorting
+            setSort("key", SortOrder.ASCENDING);
+            comparator =
+                    new SortableDataProviderComparator<ReportTO>(this);
+        }
+
+        @Override
+        public Iterator<ReportTO> iterator(final int first,
+                final int count) {
+
+            List<ReportTO> list = reportRestClient.list(
+                    (first / paginatorRows) + 1, paginatorRows);
+
+            Collections.sort(list, comparator);
+
+            return list.iterator();
+        }
+
+        @Override
+        public int size() {
+            return reportRestClient.count();
+        }
+
+        @Override
+        public IModel<ReportTO> model(final ReportTO configuration) {
+
+            return new AbstractReadOnlyModel<ReportTO>() {
+
+                private static final long serialVersionUID =
+                        4921104837546595602L;
+
+                @Override
+                public ReportTO getObject() {
+                    return configuration;
+                }
+            };
+        }
     }
 }

Modified: incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/TaskModalPage.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/TaskModalPage.java?rev=1292848&r1=1292847&r2=1292848&view=diff
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/TaskModalPage.java (original)
+++ incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/TaskModalPage.java Thu Feb 23 16:38:01 2012
@@ -35,7 +35,6 @@ import org.apache.wicket.extensions.mark
 import org.apache.wicket.markup.html.WebMarkupContainer;
 import org.apache.wicket.markup.html.basic.Label;
 import org.apache.wicket.markup.html.form.Form;
-import org.apache.wicket.markup.html.form.FormComponent;
 import org.apache.wicket.markup.repeater.Item;
 import org.apache.wicket.model.AbstractReadOnlyModel;
 import org.apache.wicket.model.CompoundPropertyModel;
@@ -152,7 +151,8 @@ public abstract class TaskModalPage exte
 
                 panel.add(new ActionLink() {
 
-                    private static final long serialVersionUID = -3722207913631435501L;
+                    private static final long serialVersionUID =
+                            -3722207913631435501L;
 
                     @Override
                     public void onClick(final AjaxRequestTarget target) {
@@ -164,7 +164,7 @@ public abstract class TaskModalPage exte
 
                                     @Override
                                     public Page createPage() {
-                                        return new TaskExecMessageModalPage(
+                                        return new ExecMessageModalPage(
                                                 model.getObject().getMessage());
                                     }
                                 });
@@ -175,7 +175,8 @@ public abstract class TaskModalPage exte
 
                 panel.add(new ActionLink() {
 
-                    private static final long serialVersionUID = -3722207913631435501L;
+                    private static final long serialVersionUID =
+                            -3722207913631435501L;
 
                     @Override
                     public void onClick(final AjaxRequestTarget target) {
@@ -193,7 +194,7 @@ public abstract class TaskModalPage exte
                         target.add(feedbackPanel);
                         target.add(executions);
                     }
-                }, ActionLink.ActionType.EDIT, "Tasks", "delete");
+                }, ActionLink.ActionType.DELETE, "Tasks", "delete");
 
                 cellItem.add(panel);
             }
@@ -215,7 +216,7 @@ public abstract class TaskModalPage exte
 
         private TaskTO taskTO;
 
-        public TaskExecutionsProvider(TaskTO taskTO) {
+        public TaskExecutionsProvider(final TaskTO taskTO) {
             //Default sorting
             this.taskTO = taskTO;
             setSort("startDate", SortOrder.ASCENDING);
@@ -227,7 +228,7 @@ public abstract class TaskModalPage exte
         public Iterator<TaskExecTO> iterator(final int first,
                 final int count) {
 
-            List<TaskExecTO> list = getTaskDB();
+            List<TaskExecTO> list = taskTO.getExecutions();
 
             Collections.sort(list, comparator);
 
@@ -236,7 +237,7 @@ public abstract class TaskModalPage exte
 
         @Override
         public int size() {
-            return getTaskDB().size();
+            return taskTO.getExecutions().size();
         }
 
         @Override
@@ -254,64 +255,5 @@ public abstract class TaskModalPage exte
                 }
             };
         }
-
-        public List<TaskExecTO> getTaskDB() {
-            return taskTO.getExecutions();
-        }
-    }
-
-    protected String getCronField(
-            final FormComponent formComponent, final int field) {
-        String cronField = null;
-
-        if (formComponent != null) {
-            cronField = getCronField(formComponent.getInput(), field);
-        }
-
-        return cronField;
-    }
-
-    protected String getCronField(
-            final String cron, final int field) {
-        String cronField = null;
-
-        if (cron != null && !cron.isEmpty() && !"UNSCHEDULE".equals(cron)) {
-            cronField = cron.split(" ")[field].trim();
-        }
-
-        return cronField;
-    }
-
-    protected String getCron(
-            final FormComponent seconds,
-            final FormComponent minutes,
-            final FormComponent hours,
-            final FormComponent daysOfMonth,
-            final FormComponent months,
-            final FormComponent daysOfWeek) {
-
-        final StringBuilder cron = new StringBuilder();
-
-        if (seconds != null && seconds.getInput() != null
-                && minutes != null && minutes.getInput() != null
-                && hours != null && hours.getInput() != null
-                && daysOfMonth != null && daysOfMonth.getInput() != null
-                && months != null && months.getInput() != null
-                && daysOfWeek != null && daysOfWeek.getInput() != null) {
-
-            cron.append(seconds.getInput().trim()).
-                    append(" ").
-                    append(minutes.getInput().trim()).
-                    append(" ").
-                    append(hours.getInput().trim()).
-                    append(" ").
-                    append(daysOfMonth.getInput().trim()).
-                    append(" ").
-                    append(months.getInput().trim()).
-                    append(" ").
-                    append(daysOfWeek.getInput().trim());
-        }
-
-        return cron.toString();
     }
 }

Modified: incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/panels/SchedTasks.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/panels/SchedTasks.java?rev=1292848&r1=1292847&r2=1292848&view=diff
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/panels/SchedTasks.java (original)
+++ incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/panels/SchedTasks.java Thu Feb 23 16:38:01 2012
@@ -145,7 +145,8 @@ public class SchedTasks extends Panel {
 
                 panel.add(new ActionLink() {
 
-                    private static final long serialVersionUID = -3722207913631435501L;
+                    private static final long serialVersionUID =
+                            -3722207913631435501L;
 
                     @Override
                     public void onClick(final AjaxRequestTarget target) {
@@ -168,7 +169,8 @@ public class SchedTasks extends Panel {
 
                 panel.add(new ActionLink() {
 
-                    private static final long serialVersionUID = -3722207913631435501L;
+                    private static final long serialVersionUID =
+                            -3722207913631435501L;
 
                     @Override
                     public void onClick(final AjaxRequestTarget target) {
@@ -186,7 +188,8 @@ public class SchedTasks extends Panel {
 
                 panel.add(new ActionLink() {
 
-                    private static final long serialVersionUID = -3722207913631435501L;
+                    private static final long serialVersionUID =
+                            -3722207913631435501L;
 
                     @Override
                     public void onClick(final AjaxRequestTarget target) {
@@ -204,7 +207,8 @@ public class SchedTasks extends Panel {
 
                 panel.add(new ActionLink() {
 
-                    private static final long serialVersionUID = -3722207913631435501L;
+                    private static final long serialVersionUID =
+                            -3722207913631435501L;
 
                     @Override
                     public void onClick(final AjaxRequestTarget target) {

Modified: incubator/syncope/trunk/console/src/main/java/org/syncope/console/rest/ConfigurationRestClient.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/syncope/console/rest/ConfigurationRestClient.java?rev=1292848&r1=1292847&r2=1292848&view=diff
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/syncope/console/rest/ConfigurationRestClient.java (original)
+++ incubator/syncope/trunk/console/src/main/java/org/syncope/console/rest/ConfigurationRestClient.java Thu Feb 23 16:38:01 2012
@@ -29,13 +29,6 @@ import org.syncope.types.LoggerLevel;
 @Component
 public class ConfigurationRestClient extends AbstractBaseRestClient {
 
-    public String dbContentAsXml()
-            throws SyncopeClientCompositeErrorException {
-
-        return restTemplate.getForObject(baseURL
-                + "configuration/dbexport.json", String.class);
-    }
-
     /**
      * Get all stored configurations.
      *

Added: incubator/syncope/trunk/console/src/main/java/org/syncope/console/rest/ExecutionRestClient.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/syncope/console/rest/ExecutionRestClient.java?rev=1292848&view=auto
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/syncope/console/rest/ExecutionRestClient.java (added)
+++ incubator/syncope/trunk/console/src/main/java/org/syncope/console/rest/ExecutionRestClient.java Thu Feb 23 16:38:01 2012
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.syncope.console.rest;
+
+import java.util.List;
+import org.syncope.client.to.AbstractExecTO;
+
+public interface ExecutionRestClient {
+
+    List<? extends AbstractExecTO> listExecutions();
+
+    void startExecution(final Long executionCollectorId);
+
+    void deleteExecution(final Long executionId);
+}

Added: incubator/syncope/trunk/console/src/main/java/org/syncope/console/rest/ReportRestClient.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/syncope/console/rest/ReportRestClient.java?rev=1292848&view=auto
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/syncope/console/rest/ReportRestClient.java (added)
+++ incubator/syncope/trunk/console/src/main/java/org/syncope/console/rest/ReportRestClient.java Thu Feb 23 16:38:01 2012
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.syncope.console.rest;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Set;
+import org.springframework.stereotype.Component;
+import org.syncope.client.to.ReportExecTO;
+import org.syncope.client.to.ReportTO;
+import org.syncope.client.validation.SyncopeClientCompositeErrorException;
+
+@Component
+public class ReportRestClient extends AbstractBaseRestClient
+        implements ExecutionRestClient {
+
+    public Set<String> getReportletClasses() {
+        Set<String> reportletClasses = null;
+
+        try {
+            reportletClasses = restTemplate.getForObject(
+                    baseURL + "report/reportletClasses.json", Set.class);
+        } catch (SyncopeClientCompositeErrorException e) {
+            LOG.error("While getting available reportlet classes", e);
+        }
+        return reportletClasses;
+    }
+
+    public List<ReportTO> list() {
+        return Arrays.asList(restTemplate.getForObject(
+                baseURL + "report/list", ReportTO[].class));
+    }
+
+    public List<ReportTO> list(final int page, final int size) {
+        return Arrays.asList(restTemplate.getForObject(
+                baseURL + "report/list/{page}/{size}.json",
+                ReportTO[].class, page, size));
+    }
+
+    public int count() {
+        return restTemplate.getForObject(
+                baseURL + "report/count.json", Integer.class);
+    }
+
+    public ReportTO create(final ReportTO reportTO) {
+        return restTemplate.postForObject(
+                baseURL + "report/create", reportTO, ReportTO.class);
+    }
+
+    public ReportTO update(final ReportTO reportTO) {
+        return restTemplate.postForObject(
+                baseURL + "report/update", reportTO, ReportTO.class);
+    }
+
+    /**
+     * Delete specified report.
+     *
+     * @param reportId report to delete
+     */
+    public void delete(final Long reportId) {
+        restTemplate.delete(
+                baseURL + "report/delete/{reportId}", reportId);
+    }
+
+    /**
+     * Start execution for the specified report.
+     *
+     * @param reportId report id
+     */
+    @Override
+    public void startExecution(final Long reportId) {
+        restTemplate.postForObject(
+                baseURL + "report/execute/{reportId}",
+                null, ReportExecTO.class, reportId);
+    }
+
+    /**
+     * Delete specified report execution.
+     *
+     * @param reportExecId report execution id
+     */
+    @Override
+    public void deleteExecution(final Long reportExecId) {
+        restTemplate.delete(baseURL
+                + "report/execution/delete/{execId}", reportExecId);
+    }
+
+    /**
+     * Get all executions.
+     *
+     * @return list of all executions
+     */
+    @Override
+    public List<ReportExecTO> listExecutions() {
+        return Arrays.asList(
+                restTemplate.getForObject(
+                baseURL + "report/execution/list",
+                ReportExecTO[].class));
+    }
+}

Modified: incubator/syncope/trunk/console/src/main/java/org/syncope/console/rest/TaskRestClient.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/syncope/console/rest/TaskRestClient.java?rev=1292848&r1=1292847&r2=1292848&view=diff
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/syncope/console/rest/TaskRestClient.java (original)
+++ incubator/syncope/trunk/console/src/main/java/org/syncope/console/rest/TaskRestClient.java Thu Feb 23 16:38:01 2012
@@ -24,10 +24,10 @@ import java.util.List;
 import java.util.Set;
 import org.springframework.stereotype.Component;
 import org.syncope.client.to.NotificationTaskTO;
-import org.syncope.client.to.TaskExecTO;
 import org.syncope.client.to.PropagationTaskTO;
 import org.syncope.client.to.SchedTaskTO;
 import org.syncope.client.to.SyncTaskTO;
+import org.syncope.client.to.TaskExecTO;
 import org.syncope.client.to.TaskTO;
 import org.syncope.client.validation.SyncopeClientCompositeErrorException;
 
@@ -35,22 +35,24 @@ import org.syncope.client.validation.Syn
  * Console client for invoking Rest Tasks services.
  */
 @Component
-public class TaskRestClient extends AbstractBaseRestClient {
+public class TaskRestClient extends AbstractBaseRestClient
+        implements ExecutionRestClient {
 
     /**
      * Return a list of job classes.
+     *
      * @return list of classes.
      */
     public Set<String> getJobClasses() {
-        Set<String> validators = null;
+        Set<String> jobClasses = null;
 
         try {
-            validators = restTemplate.getForObject(
+            jobClasses = restTemplate.getForObject(
                     baseURL + "task/jobClasses.json", Set.class);
         } catch (SyncopeClientCompositeErrorException e) {
             LOG.error("While getting all job classes", e);
         }
-        return validators;
+        return jobClasses;
     }
 
     public Set<String> getJobActionsClasses() {
@@ -67,6 +69,7 @@ public class TaskRestClient extends Abst
 
     /**
      * Return the number of tasks.
+     *
      * @param kind of task (propagation, sched, sync).
      * @return number of stored tasks.
      */
@@ -77,6 +80,7 @@ public class TaskRestClient extends Abst
 
     /**
      * Return a paginated list of tasks.
+     *
      * @param page number.
      * @param size per page.
      * @return paginated list.
@@ -135,8 +139,10 @@ public class TaskRestClient extends Abst
 
     /**
      * Get all executions.
+     *
      * @return list of all executions
      */
+    @Override
     public List<TaskExecTO> listExecutions() {
         return Arrays.asList(
                 restTemplate.getForObject(
@@ -146,6 +152,7 @@ public class TaskRestClient extends Abst
 
     /**
      * Delete specified task.
+     *
      * @param taskId task to delete
      */
     public void delete(final Long taskId) {
@@ -153,8 +160,14 @@ public class TaskRestClient extends Abst
                 baseURL + "task/delete/{taskId}", taskId);
     }
 
+    @Override
+    public void startExecution(final Long taskId) {
+        startExecution(taskId, false);
+    }
+
     /**
      * Start execution for the specified TaskTO.
+     *
      * @param taskId task id
      */
     public void startExecution(final Long taskId, boolean dryRun) {
@@ -165,8 +178,10 @@ public class TaskRestClient extends Abst
 
     /**
      * Delete specified task's execution.
+     *
      * @param taskExecId task execution id
      */
+    @Override
     public void deleteExecution(final Long taskExecId) {
         restTemplate.delete(baseURL
                 + "task/execution/delete/{execId}", taskExecId);

Added: incubator/syncope/trunk/console/src/main/java/org/syncope/console/wicket/ajax/form/AbstractAjaxDownloadBehavior.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/syncope/console/wicket/ajax/form/AbstractAjaxDownloadBehavior.java?rev=1292848&view=auto
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/syncope/console/wicket/ajax/form/AbstractAjaxDownloadBehavior.java (added)
+++ incubator/syncope/trunk/console/src/main/java/org/syncope/console/wicket/ajax/form/AbstractAjaxDownloadBehavior.java Thu Feb 23 16:38:01 2012
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.syncope.console.wicket.ajax.form;
+
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.behavior.AbstractAjaxBehavior;
+import org.apache.wicket.request.handler.resource.ResourceStreamRequestHandler;
+import org.apache.wicket.util.resource.IResourceStream;
+
+public abstract class AbstractAjaxDownloadBehavior
+        extends AbstractAjaxBehavior {
+
+    private static final long serialVersionUID = 6833760760338614245L;
+
+    /**
+     * Call this method to initiate the download.
+     */
+    public void initiate(final AjaxRequestTarget target) {
+        CharSequence url = getCallbackUrl();
+
+        target.appendJavaScript("window.location.href='" + url + "'");
+    }
+
+    @Override
+    public void onRequest() {
+        getComponent().getRequestCycle().scheduleRequestHandlerAfterCurrent(
+                new ResourceStreamRequestHandler(
+                getResourceStream(), getFileName()));
+    }
+
+    protected abstract String getFileName();
+
+    protected abstract IResourceStream getResourceStream();
+}

Propchange: incubator/syncope/trunk/console/src/main/java/org/syncope/console/wicket/ajax/form/AbstractAjaxDownloadBehavior.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/syncope/trunk/console/src/main/java/org/syncope/console/wicket/ajax/form/AbstractAjaxDownloadBehavior.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/syncope/trunk/console/src/main/java/org/syncope/console/wicket/ajax/form/AbstractAjaxDownloadBehavior.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/syncope/trunk/console/src/main/java/org/syncope/console/wicket/markup/html/form/ActionLink.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/syncope/console/wicket/markup/html/form/ActionLink.java?rev=1292848&r1=1292847&r2=1292848&view=diff
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/syncope/console/wicket/markup/html/form/ActionLink.java (original)
+++ incubator/syncope/trunk/console/src/main/java/org/syncope/console/wicket/markup/html/form/ActionLink.java Thu Feb 23 16:38:01 2012
@@ -34,7 +34,9 @@ public abstract class ActionLink impleme
         DELETE,
         EXECUTE,
         DRYRUN,
-        CLAIM
+        CLAIM,
+        EXPORT
+
     }
 
     public abstract void onClick(final AjaxRequestTarget target);