-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #880 from puzzle/IPA-Lias
IPA Lias
- Loading branch information
Showing
51 changed files
with
2,615 additions
and
125 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
41 changes: 41 additions & 0 deletions
41
backend/src/main/java/ch/puzzle/okr/controller/AlignmentController.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,41 @@ | ||
package ch.puzzle.okr.controller; | ||
|
||
import ch.puzzle.okr.dto.alignment.AlignmentLists; | ||
import ch.puzzle.okr.service.business.AlignmentBusinessService; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.media.Content; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponses; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import java.util.List; | ||
|
||
@RestController | ||
@RequestMapping("api/v2/alignments") | ||
public class AlignmentController { | ||
private final AlignmentBusinessService alignmentBusinessService; | ||
|
||
public AlignmentController(AlignmentBusinessService alignmentBusinessService) { | ||
this.alignmentBusinessService = alignmentBusinessService; | ||
} | ||
|
||
@Operation(summary = "Get AlignmentLists from filter", description = "Get a list of AlignmentObjects with all AlignmentConnections, which match current quarter, team and objective filter") | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "200", description = "Returned AlignmentLists, which match current filters", content = { | ||
@Content(mediaType = "application/json", schema = @Schema(implementation = AlignmentLists.class)) }), | ||
@ApiResponse(responseCode = "400", description = "Can't generate AlignmentLists from current filters", content = @Content) }) | ||
@GetMapping("/alignmentLists") | ||
public ResponseEntity<AlignmentLists> getAlignments( | ||
@RequestParam(required = false, defaultValue = "", name = "teamFilter") List<Long> teamFilter, | ||
@RequestParam(required = false, defaultValue = "", name = "quarterFilter") Long quarterFilter, | ||
@RequestParam(required = false, defaultValue = "", name = "objectiveQuery") String objectiveQuery) { | ||
return ResponseEntity.status(HttpStatus.OK) | ||
.body(alignmentBusinessService.getAlignmentListsByFilters(quarterFilter, teamFilter, objectiveQuery)); | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
backend/src/main/java/ch/puzzle/okr/dto/alignment/AlignmentConnectionDto.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,5 @@ | ||
|
||
package ch.puzzle.okr.dto.alignment; | ||
|
||
public record AlignmentConnectionDto(Long alignedObjectiveId, Long targetObjectiveId, Long targetKeyResultId) { | ||
} |
7 changes: 7 additions & 0 deletions
7
backend/src/main/java/ch/puzzle/okr/dto/alignment/AlignmentLists.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,7 @@ | ||
package ch.puzzle.okr.dto.alignment; | ||
|
||
import java.util.List; | ||
|
||
public record AlignmentLists(List<AlignmentObjectDto> alignmentObjectDtoList, | ||
List<AlignmentConnectionDto> alignmentConnectionDtoList) { | ||
} |
5 changes: 5 additions & 0 deletions
5
backend/src/main/java/ch/puzzle/okr/dto/alignment/AlignmentObjectDto.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,5 @@ | ||
package ch.puzzle.okr.dto.alignment; | ||
|
||
public record AlignmentObjectDto(Long objectId, String objectTitle, String objectTeamName, String objectState, | ||
String objectType) { | ||
} |
236 changes: 236 additions & 0 deletions
236
backend/src/main/java/ch/puzzle/okr/models/alignment/AlignmentView.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,236 @@ | ||
package ch.puzzle.okr.models.alignment; | ||
|
||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.Id; | ||
import org.hibernate.annotations.Immutable; | ||
|
||
import java.util.Objects; | ||
|
||
@Entity | ||
@Immutable | ||
public class AlignmentView { | ||
|
||
@Id | ||
private String uniqueId; | ||
private Long id; | ||
private String title; | ||
private Long teamId; | ||
private String teamName; | ||
private Long quarterId; | ||
private String state; | ||
private String objectType; | ||
private String connectionRole; | ||
private Long counterpartId; | ||
private String counterpartType; | ||
|
||
public AlignmentView() { | ||
} | ||
|
||
private AlignmentView(Builder builder) { | ||
setUniqueId(builder.uniqueId); | ||
setId(builder.id); | ||
setTitle(builder.title); | ||
setTeamId(builder.teamId); | ||
setTeamName(builder.teamName); | ||
setQuarterId(builder.quarterId); | ||
setState(builder.state); | ||
setObjectType(builder.objectType); | ||
setConnectionRole(builder.connectionRole); | ||
setCounterpartId(builder.counterpartId); | ||
setCounterpartType(builder.counterpartType); | ||
} | ||
|
||
public void setUniqueId(String uniqueId) { | ||
this.uniqueId = uniqueId; | ||
} | ||
|
||
public Long getId() { | ||
return id; | ||
} | ||
|
||
public void setId(Long id) { | ||
this.id = id; | ||
} | ||
|
||
public String getTitle() { | ||
return title; | ||
} | ||
|
||
public void setTitle(String title) { | ||
this.title = title; | ||
} | ||
|
||
public Long getTeamId() { | ||
return teamId; | ||
} | ||
|
||
public void setTeamId(Long teamId) { | ||
this.teamId = teamId; | ||
} | ||
|
||
public String getTeamName() { | ||
return teamName; | ||
} | ||
|
||
public void setTeamName(String teamName) { | ||
this.teamName = teamName; | ||
} | ||
|
||
public Long getQuarterId() { | ||
return quarterId; | ||
} | ||
|
||
public void setQuarterId(Long quarterId) { | ||
this.quarterId = quarterId; | ||
} | ||
|
||
public String getState() { | ||
return state; | ||
} | ||
|
||
public void setState(String state) { | ||
this.state = state; | ||
} | ||
|
||
public String getObjectType() { | ||
return objectType; | ||
} | ||
|
||
public void setObjectType(String objectType) { | ||
this.objectType = objectType; | ||
} | ||
|
||
public String getConnectionRole() { | ||
return connectionRole; | ||
} | ||
|
||
public void setConnectionRole(String connectionItem) { | ||
this.connectionRole = connectionItem; | ||
} | ||
|
||
public Long getCounterpartId() { | ||
return counterpartId; | ||
} | ||
|
||
public void setCounterpartId(Long refId) { | ||
this.counterpartId = refId; | ||
} | ||
|
||
public String getCounterpartType() { | ||
return counterpartType; | ||
} | ||
|
||
public void setCounterpartType(String refType) { | ||
this.counterpartType = refType; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) | ||
return true; | ||
if (o == null || getClass() != o.getClass()) | ||
return false; | ||
AlignmentView that = (AlignmentView) o; | ||
return Objects.equals(uniqueId, that.uniqueId) && Objects.equals(id, that.id) | ||
&& Objects.equals(title, that.title) && Objects.equals(teamId, that.teamId) | ||
&& Objects.equals(teamName, that.teamName) && Objects.equals(quarterId, that.quarterId) | ||
&& Objects.equals(state, that.state) && Objects.equals(objectType, that.objectType) | ||
&& Objects.equals(connectionRole, that.connectionRole) | ||
&& Objects.equals(counterpartId, that.counterpartId) | ||
&& Objects.equals(counterpartType, that.counterpartType); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(uniqueId, id, title, teamId, teamName, quarterId, state, objectType, connectionRole, | ||
counterpartId, counterpartType); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "AlignmentView{" + "uniqueId='" + uniqueId + '\'' + ", id=" + id + ", title='" + title + '\'' | ||
+ ", teamId=" + teamId + ", teamName='" + teamName + '\'' + ", quarterId=" + quarterId + ", state='" | ||
+ state + '\'' + ", objectType='" + objectType + '\'' + ", connectionItem='" + connectionRole + '\'' | ||
+ ", refId=" + counterpartId + ", refType='" + counterpartType + '\'' + '}'; | ||
} | ||
|
||
public static final class Builder { | ||
private String uniqueId; | ||
private Long id; | ||
private String title; | ||
private Long teamId; | ||
private String teamName; | ||
private Long quarterId; | ||
private String state; | ||
private String objectType; | ||
private String connectionRole; | ||
private Long counterpartId; | ||
private String counterpartType; | ||
|
||
private Builder() { | ||
} | ||
|
||
public static AlignmentView.Builder builder() { | ||
return new AlignmentView.Builder(); | ||
} | ||
|
||
public Builder withUniqueId(String val) { | ||
uniqueId = val; | ||
return this; | ||
} | ||
|
||
public Builder withId(Long val) { | ||
id = val; | ||
return this; | ||
} | ||
|
||
public Builder withTitle(String val) { | ||
title = val; | ||
return this; | ||
} | ||
|
||
public Builder withTeamId(Long val) { | ||
teamId = val; | ||
return this; | ||
} | ||
|
||
public Builder withTeamName(String val) { | ||
teamName = val; | ||
return this; | ||
} | ||
|
||
public Builder withQuarterId(Long val) { | ||
quarterId = val; | ||
return this; | ||
} | ||
|
||
public Builder withState(String val) { | ||
state = val; | ||
return this; | ||
} | ||
|
||
public Builder withObjectType(String val) { | ||
objectType = val; | ||
return this; | ||
} | ||
|
||
public Builder withConnectionRole(String val) { | ||
connectionRole = val; | ||
return this; | ||
} | ||
|
||
public Builder withCounterpartId(Long val) { | ||
counterpartId = val; | ||
return this; | ||
} | ||
|
||
public Builder withCounterpartType(String val) { | ||
counterpartType = val; | ||
return this; | ||
} | ||
|
||
public AlignmentView build() { | ||
return new AlignmentView(this); | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
backend/src/main/java/ch/puzzle/okr/repository/AlignmentViewRepository.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,14 @@ | ||
package ch.puzzle.okr.repository; | ||
|
||
import ch.puzzle.okr.models.alignment.AlignmentView; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.data.repository.CrudRepository; | ||
import org.springframework.data.repository.query.Param; | ||
|
||
import java.util.List; | ||
|
||
public interface AlignmentViewRepository extends CrudRepository<AlignmentView, Long> { | ||
|
||
@Query(value = "SELECT * FROM alignment_view where quarter_id = :quarterId ", nativeQuery = true) | ||
List<AlignmentView> getAlignmentViewByQuarterId(@Param("quarterId") Long quarterId); | ||
} |
Oops, something went wrong.