-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[3655] Support "Delete Task Dependency" tool in gantt
Bug: #3655 Signed-off-by: Laurent Fasani <[email protected]>
- Loading branch information
Showing
60 changed files
with
1,407 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...lipse/sirius/components/collaborative/gantt/dto/input/DeleteGanttTaskDependencyInput.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 Obeo. | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Obeo - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.sirius.components.collaborative.gantt.dto.input; | ||
|
||
import java.util.Objects; | ||
import java.util.UUID; | ||
|
||
import org.eclipse.sirius.components.collaborative.gantt.api.IGanttInput; | ||
|
||
/** | ||
* The input of the "Delete task dependency" mutation. | ||
* | ||
* @author lfasani | ||
*/ | ||
public record DeleteGanttTaskDependencyInput(UUID id, String editingContextId, String representationId, String sourceTaskId, String targetTaskId) implements IGanttInput { | ||
public DeleteGanttTaskDependencyInput { | ||
Objects.requireNonNull(id); | ||
Objects.requireNonNull(editingContextId); | ||
Objects.requireNonNull(representationId); | ||
Objects.requireNonNull(sourceTaskId); | ||
Objects.requireNonNull(targetTaskId); | ||
} | ||
} |
79 changes: 79 additions & 0 deletions
79
...ipse/sirius/components/collaborative/gantt/handlers/DeleteTaskDependencyEventHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 Obeo. | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Obeo - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.sirius.components.collaborative.gantt.handlers; | ||
|
||
import java.util.Objects; | ||
|
||
import org.eclipse.sirius.components.collaborative.api.ChangeDescription; | ||
import org.eclipse.sirius.components.collaborative.api.ChangeKind; | ||
import org.eclipse.sirius.components.collaborative.api.Monitoring; | ||
import org.eclipse.sirius.components.collaborative.gantt.api.IGanttContext; | ||
import org.eclipse.sirius.components.collaborative.gantt.api.IGanttEventHandler; | ||
import org.eclipse.sirius.components.collaborative.gantt.api.IGanttInput; | ||
import org.eclipse.sirius.components.collaborative.gantt.api.IGanttTaskService; | ||
import org.eclipse.sirius.components.collaborative.gantt.dto.input.DeleteGanttTaskDependencyInput; | ||
import org.eclipse.sirius.components.collaborative.gantt.message.ICollaborativeGanttMessageService; | ||
import org.eclipse.sirius.components.core.api.ErrorPayload; | ||
import org.eclipse.sirius.components.core.api.IEditingContext; | ||
import org.eclipse.sirius.components.core.api.IPayload; | ||
import org.springframework.stereotype.Service; | ||
|
||
import io.micrometer.core.instrument.Counter; | ||
import io.micrometer.core.instrument.MeterRegistry; | ||
import reactor.core.publisher.Sinks.Many; | ||
import reactor.core.publisher.Sinks.One; | ||
|
||
/** | ||
* Handle "Delete Task Dependency" events. | ||
* | ||
* @author lfasani | ||
*/ | ||
@Service | ||
public class DeleteTaskDependencyEventHandler implements IGanttEventHandler { | ||
|
||
private final IGanttTaskService ganttTaskService; | ||
|
||
private final ICollaborativeGanttMessageService messageService; | ||
|
||
private final Counter counter; | ||
|
||
public DeleteTaskDependencyEventHandler(IGanttTaskService ganttTaskService, ICollaborativeGanttMessageService messageService, MeterRegistry meterRegistry) { | ||
this.ganttTaskService = Objects.requireNonNull(ganttTaskService); | ||
this.messageService = Objects.requireNonNull(messageService); | ||
|
||
this.counter = Counter.builder(Monitoring.EVENT_HANDLER).tag(Monitoring.NAME, this.getClass().getSimpleName()).register(meterRegistry); | ||
} | ||
|
||
@Override | ||
public boolean canHandle(IGanttInput ganttInput) { | ||
return ganttInput instanceof DeleteGanttTaskDependencyInput; | ||
} | ||
|
||
@Override | ||
public void handle(One<IPayload> payloadSink, Many<ChangeDescription> changeDescriptionSink, IEditingContext editingContext, IGanttContext ganttContext, IGanttInput ganttInput) { | ||
this.counter.increment(); | ||
|
||
String message = this.messageService.invalidInput(ganttInput.getClass().getSimpleName(), DeleteGanttTaskDependencyInput.class.getSimpleName()); | ||
IPayload payload = new ErrorPayload(ganttInput.id(), message); | ||
ChangeDescription changeDescription = new ChangeDescription(ChangeKind.NOTHING, ganttInput.representationId(), ganttInput); | ||
|
||
if (ganttInput instanceof DeleteGanttTaskDependencyInput input) { | ||
payload = this.ganttTaskService.deleteTaskDependency(input, editingContext, ganttContext.getGantt()); | ||
|
||
changeDescription = new ChangeDescription(ChangeKind.SEMANTIC_CHANGE, ganttInput.representationId(), ganttInput); | ||
} | ||
|
||
payloadSink.tryEmitValue(payload); | ||
changeDescriptionSink.tryEmitNext(changeDescription); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.