-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ba17c93
commit 2146de4
Showing
19 changed files
with
254 additions
and
205 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
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
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
22 changes: 22 additions & 0 deletions
22
server/src/main/java/io/flexwork/modules/teams/service/dto/WorkflowDetailedDTO.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,22 @@ | ||
package io.flexwork.modules.teams.service.dto; | ||
|
||
import java.util.List; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import lombok.experimental.SuperBuilder; | ||
|
||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@SuperBuilder | ||
public class WorkflowDetailedDTO extends WorkflowDTO { | ||
|
||
private String | ||
ownerName; // return the team name that own this workflow, if workflow is global then | ||
// its value is null | ||
|
||
private List<WorkflowStateDTO> states; | ||
|
||
private List<WorkflowTransitionDTO> transitions; | ||
} |
20 changes: 20 additions & 0 deletions
20
server/src/main/java/io/flexwork/modules/teams/service/dto/WorkflowTransitionDTO.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,20 @@ | ||
package io.flexwork.modules.teams.service.dto; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Builder | ||
public class WorkflowTransitionDTO { | ||
private Long id; | ||
private Long workflowId; // ID of the associated Workflow | ||
private Long sourceStateId; // ID of the source state | ||
private Long targetStateId; // ID of the target state | ||
private String eventName; // Name of the triggering event | ||
private Long slaDuration; // SLA duration for the transition (nullable) | ||
private boolean escalateOnViolation; // Whether to escalate on SLA violation | ||
} |
19 changes: 11 additions & 8 deletions
19
server/src/main/java/io/flexwork/modules/teams/service/mapper/WorkflowMapper.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 |
---|---|---|
@@ -1,22 +1,25 @@ | ||
package io.flexwork.modules.teams.service.mapper; | ||
|
||
import io.flexwork.modules.teams.domain.Team; | ||
import io.flexwork.modules.teams.domain.Workflow; | ||
import io.flexwork.modules.teams.service.dto.WorkflowDTO; | ||
import io.flexwork.modules.teams.service.dto.WorkflowDetailedDTO; | ||
import org.mapstruct.Mapper; | ||
import org.mapstruct.Mapping; | ||
import org.mapstruct.Named; | ||
import org.mapstruct.MappingTarget; | ||
|
||
@Mapper(componentModel = "spring") | ||
@Mapper( | ||
componentModel = "spring", | ||
uses = {WorkflowStateMapper.class, WorkflowTransitionMapper.class}) | ||
public interface WorkflowMapper { | ||
|
||
@Mapping(source = "owner", target = "isGlobal", qualifiedByName = "mapIsGlobal") | ||
@Mapping(source = "owner.id", target = "ownerId") | ||
WorkflowDTO toDto(Workflow workflow); | ||
|
||
Workflow toEntity(WorkflowDTO workflowDTO); | ||
|
||
@Named("mapIsGlobal") | ||
default boolean mapIsGlobal(Team owner) { | ||
return owner == null; // If owner is null, it's a global workflow | ||
} | ||
@Mapping(source = "owner.name", target = "ownerName") | ||
@Mapping(source = "owner.id", target = "ownerId") | ||
WorkflowDetailedDTO toDetailedDto(Workflow workflow); | ||
|
||
Workflow updateEntity(WorkflowDTO workflowDTO, @MappingTarget Workflow workflow); | ||
} |
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
20 changes: 20 additions & 0 deletions
20
server/src/main/java/io/flexwork/modules/teams/service/mapper/WorkflowTransitionMapper.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,20 @@ | ||
package io.flexwork.modules.teams.service.mapper; | ||
|
||
import io.flexwork.modules.teams.domain.WorkflowTransition; | ||
import io.flexwork.modules.teams.service.dto.WorkflowTransitionDTO; | ||
import java.util.List; | ||
import org.mapstruct.Mapper; | ||
import org.mapstruct.Mapping; | ||
|
||
@Mapper(componentModel = "spring") | ||
public interface WorkflowTransitionMapper { | ||
|
||
@Mapping(source = "sourceState.id", target = "sourceStateId") | ||
@Mapping(source = "targetState.id", target = "targetStateId") | ||
@Mapping(source = "workflow.id", target = "workflowId") | ||
WorkflowTransitionDTO toDTO(WorkflowTransition transition); | ||
|
||
WorkflowTransition toEntity(WorkflowTransitionDTO transitionDTO); | ||
|
||
List<WorkflowTransitionDTO> toDTOList(List<WorkflowTransition> transitions); | ||
} |
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.