You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by md...@apache.org on 2018/02/21 11:58:07 UTC
syncope git commit: [SYNCOPE-1275] Added the possibility to delete a
scheduled job
Repository: syncope
Updated Branches:
refs/heads/master 78cd2eba4 -> 0ee44d88c
[SYNCOPE-1275] Added the possibility to delete a scheduled job
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/0ee44d88
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/0ee44d88
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/0ee44d88
Branch: refs/heads/master
Commit: 0ee44d88c519da839d0310bc6c1d74d9376054fc
Parents: 78cd2eb
Author: Marco Di Sabatino Di Diodoro <ma...@tirasa.net>
Authored: Wed Feb 21 12:55:25 2018 +0100
Committer: Marco Di Sabatino Di Diodoro <ma...@tirasa.net>
Committed: Wed Feb 21 12:57:34 2018 +0100
----------------------------------------------------------------------
.../client/console/widgets/JobWidget.java | 49 ++++++++++++++++++++
.../syncope/common/lib/types/JobAction.java | 3 +-
.../syncope/core/logic/AbstractJobLogic.java | 4 ++
3 files changed, 55 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/0ee44d88/client/console/src/main/java/org/apache/syncope/client/console/widgets/JobWidget.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/widgets/JobWidget.java b/client/console/src/main/java/org/apache/syncope/client/console/widgets/JobWidget.java
index 5e4a9d5..a26da84 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/widgets/JobWidget.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/widgets/JobWidget.java
@@ -18,6 +18,8 @@
*/
package org.apache.syncope.client.console.widgets;
+import static org.apache.wicket.Component.ENABLE;
+
import de.agilecoders.wicket.core.markup.html.bootstrap.dialog.Modal;
import de.agilecoders.wicket.core.markup.html.bootstrap.tabs.AjaxBootstrapTabbedPanel;
import java.io.Serializable;
@@ -28,8 +30,10 @@ import java.util.Iterator;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.client.console.SyncopeConsoleSession;
+import org.apache.syncope.client.console.commons.Constants;
import org.apache.syncope.client.console.commons.DirectoryDataProvider;
import org.apache.syncope.client.console.commons.SortableDataProviderComparator;
+import org.apache.syncope.client.console.pages.BasePage;
import org.apache.syncope.client.console.panels.DirectoryPanel;
import org.apache.syncope.client.console.panels.ExecMessageModal;
import org.apache.syncope.client.console.reports.ReportWizardBuilder;
@@ -49,11 +53,13 @@ import org.apache.syncope.client.console.wicket.markup.html.form.ActionLinksTogg
import org.apache.syncope.client.console.wicket.markup.html.form.ActionsPanel;
import org.apache.syncope.client.console.wizards.AjaxWizard;
import org.apache.syncope.client.console.wizards.WizardMgtPanel;
+import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.to.ExecTO;
import org.apache.syncope.common.lib.to.JobTO;
import org.apache.syncope.common.lib.to.ReportTO;
import org.apache.syncope.common.lib.to.ProvisioningTaskTO;
import org.apache.syncope.common.lib.to.PullTaskTO;
+import org.apache.syncope.common.lib.types.JobAction;
import org.apache.syncope.common.lib.types.JobType;
import org.apache.syncope.common.lib.types.StandardEntitlement;
import org.apache.syncope.common.lib.types.TaskType;
@@ -488,6 +494,49 @@ public class JobWidget extends BaseWidget {
}, ActionType.COMPOSE, StandardEntitlement.TASK_UPDATE);
+ panel.add(new ActionLink<JobTO>() {
+
+ private static final long serialVersionUID = -3722207913631435501L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target, final JobTO ignore) {
+ try {
+ if (null != jobTO.getType()) {
+ switch (jobTO.getType()) {
+
+ case NOTIFICATION:
+ break;
+
+ case REPORT:
+ new ReportRestClient().actionJob(jobTO.getRefKey(), JobAction.DELETE);
+ break;
+
+ case TASK:
+ new TaskRestClient().actionJob(jobTO.getRefKey(), JobAction.DELETE);
+ break;
+
+ default:
+ break;
+ }
+ SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
+ target.add(container);
+ }
+ } catch (SyncopeClientException e) {
+ LOG.error("While deleting object {}", jobTO.getRefKey(), e);
+ SyncopeConsoleSession.get().error(StringUtils.isBlank(e.getMessage()) ? e.getClass().
+ getName() : e.getMessage());
+ }
+ ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
+ }
+
+ @Override
+ protected boolean statusCondition(final JobTO modelObject) {
+ return (null != jobTO.getType()
+ && !JobType.NOTIFICATION.equals(jobTO.getType())
+ && (jobTO.isScheduled() && !jobTO.isRunning()));
+ }
+ }, ActionLink.ActionType.DELETE, StandardEntitlement.TASK_DELETE, true);
+
return panel;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/0ee44d88/common/lib/src/main/java/org/apache/syncope/common/lib/types/JobAction.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/JobAction.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/JobAction.java
index 920393b..dbf000b 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/JobAction.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/JobAction.java
@@ -24,6 +24,7 @@ import javax.xml.bind.annotation.XmlEnum;
public enum JobAction {
START,
- STOP;
+ STOP,
+ DELETE;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/0ee44d88/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractJobLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractJobLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractJobLogic.java
index e189930..a93ae2d 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractJobLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractJobLogic.java
@@ -91,6 +91,10 @@ abstract class AbstractJobLogic<T extends AbstractBaseBean> extends AbstractTran
scheduler.getScheduler().interrupt(jobKey);
break;
+ case DELETE:
+ scheduler.getScheduler().deleteJob(jobKey);
+ break;
+
default:
}
} else {