sergehuber commented on code in PR #755:
URL: https://github.com/apache/unomi/pull/755#discussion_r3253185718


##########
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/dev/commands/UndeployDefinition.java:
##########
@@ -0,0 +1,97 @@
+/*
+ * 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.apache.unomi.shell.dev.commands;
+
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.unomi.api.Patch;
+import org.apache.unomi.api.PersonaWithSessions;
+import org.apache.unomi.api.PropertyType;
+import org.apache.unomi.api.actions.ActionType;
+import org.apache.unomi.api.campaigns.Campaign;
+import org.apache.unomi.api.conditions.ConditionType;
+import org.apache.unomi.api.goals.Goal;
+import org.apache.unomi.api.rules.Rule;
+import org.apache.unomi.api.segments.Scoring;
+import org.apache.unomi.api.segments.Segment;
+
+import java.io.IOException;
+import java.io.PrintStream;
+import java.net.URL;
+
+@Command(scope = "unomi", name = "undeploy-definition", description = "This 
will undeploy definitions contained in bundles")
+@Service
+public class UndeployDefinition extends DeploymentCommandSupport {
+
+    public void processDefinition(String definitionType, URL definitionURL) {
+        try {
+            processDefinitionInternal(definitionType, definitionURL, 
getConsole(), "Predefined definition unregistered");
+        } catch (IOException e) {
+            handleDefinitionError(definitionURL, "removing", e);
+        }
+    }
+
+    @Override
+    protected boolean processDefinitionByType(String definitionType, URL 
definitionURL, PrintStream console) throws IOException {
+        switch (definitionType) {
+            case CONDITION_DEFINITION_TYPE:
+                ConditionType conditionType = readDefinition(definitionURL, 
ConditionType.class);
+                definitionsService.removeActionType(conditionType.getItemId());
+                return true;
+            case ACTION_DEFINITION_TYPE:

Review Comment:
   Fixed: condition undeploy now calls 
definitionsService.removeConditionType(...).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to