ilgrosso commented on a change in pull request #213:
URL: https://github.com/apache/syncope/pull/213#discussion_r491933148



##########
File path: 
core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPATaskDAO.java
##########
@@ -436,7 +413,13 @@ public int count(
     @Transactional(rollbackFor = { Throwable.class })
     @Override
     public <T extends Task> T save(final T task) {
-        return entityManager().merge(task);
+        T merged = entityManager().merge(task);
+
+        // propagate the event only for Propagation tasks
+        if (merged instanceof PropagationTask) {
+            publisher.publishEvent(new TaskCreatedUpdatedEvent<>(this, merged, 
AuthContextUtils.getDomain()));

Review comment:
       It does not make much sense to leave open about things that will never 
be invoked, as the only caller can realistically be `JPATaskDAO`, and a clear 
`if` is placed there around publisher invocation.

##########
File path: 
core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/AbstractSchedTask.java
##########
@@ -0,0 +1,121 @@
+/*
+ * 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.syncope.core.persistence.jpa.entity.task;
+
+import java.util.Date;
+import javax.persistence.MappedSuperclass;
+import javax.persistence.OneToOne;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import javax.validation.constraints.NotNull;
+import org.apache.syncope.common.lib.types.ImplementationType;
+import org.apache.syncope.core.persistence.api.entity.Implementation;
+import org.apache.syncope.core.persistence.api.entity.task.SchedTask;
+import org.apache.syncope.core.persistence.jpa.entity.JPAImplementation;
+
+@MappedSuperclass
+public abstract class AbstractSchedTask extends AbstractTask implements 
SchedTask {

Review comment:
       No, my comment as above is just about removing `implements SchedTask ` 
from `AbstractSchedTask`, since, in the same inheritance tree, there is a 
subclass, e.g. `JPASchedTask` implementing the same interface - not very clean.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to