-
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.
- Loading branch information
1 parent
91a274b
commit eed456d
Showing
11 changed files
with
122 additions
and
113 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
29 changes: 24 additions & 5 deletions
29
server/src/main/java/io/flexwork/modules/teams/domain/TeamRequestPriority.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,9 +1,28 @@ | ||
package io.flexwork.modules.teams.domain; | ||
|
||
public enum TeamRequestPriority { | ||
Critical, | ||
High, | ||
Medium, | ||
Low, | ||
Trivial | ||
Critical(0), | ||
High(1), | ||
Medium(2), | ||
Low(3), | ||
Trivial(4); | ||
|
||
private final int code; | ||
|
||
TeamRequestPriority(int code) { | ||
this.code = code; | ||
} | ||
|
||
public int getCode() { | ||
return code; | ||
} | ||
|
||
public static TeamRequestPriority fromCode(int code) { | ||
for (TeamRequestPriority priority : TeamRequestPriority.values()) { | ||
if (priority.code == code) { | ||
return priority; | ||
} | ||
} | ||
throw new IllegalArgumentException("Invalid code for TeamRequestPriority: " + code); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
server/src/main/java/io/flexwork/modules/teams/domain/TeamRequestPriorityConverter.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,19 @@ | ||
package io.flexwork.modules.teams.domain; | ||
|
||
import jakarta.persistence.AttributeConverter; | ||
import jakarta.persistence.Converter; | ||
|
||
@Converter(autoApply = true) | ||
public class TeamRequestPriorityConverter | ||
implements AttributeConverter<TeamRequestPriority, Integer> { | ||
|
||
@Override | ||
public Integer convertToDatabaseColumn(TeamRequestPriority priority) { | ||
return (priority != null) ? priority.getCode() : null; | ||
} | ||
|
||
@Override | ||
public TeamRequestPriority convertToEntityAttribute(Integer code) { | ||
return (code != null) ? TeamRequestPriority.fromCode(code) : null; | ||
} | ||
} |
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
Oops, something went wrong.