Merge branch 'feat/dev_251201' of https://kamco.gitea.gs.dabeeo.com/dabeeo/kamco-dabeeo-backoffice into feat/dev_251201
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package com.kamco.cd.kamcoback.common.enums;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
|
||||
public class ApiConfigEnum {
|
||||
|
||||
@Getter
|
||||
@EqualsAndHashCode(of = "enumValue")
|
||||
public static class EnumDto<T> {
|
||||
|
||||
private final T enumValue;
|
||||
private final String id;
|
||||
private final String text;
|
||||
|
||||
public EnumDto(T enumValue, String id, String text) {
|
||||
this.enumValue = enumValue;
|
||||
this.id = id;
|
||||
this.text = text;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.kamco.cd.kamcoback.common.enums;
|
||||
|
||||
import com.kamco.cd.kamcoback.common.utils.enums.EnumType;
|
||||
import java.util.Arrays;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* Common usage status used across the system.
|
||||
*
|
||||
* <p>This enum represents whether a resource is active, excluded from processing, or inactive. It
|
||||
* is commonly used for filtering, business rules, and status management.
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum CommonUseStatus implements EnumType {
|
||||
|
||||
// @formatter:off
|
||||
USE("USE", "Active", 100)
|
||||
/** Actively used and available */
|
||||
,
|
||||
EXCEPT("EXCEPT", "Excluded", 200)
|
||||
/** Explicitly excluded from use or processing */
|
||||
,
|
||||
NOT_USE("NOT_USE", "Inactive", 999)
|
||||
/** Not used or disabled */
|
||||
;
|
||||
// @formatter:on
|
||||
|
||||
private String id;
|
||||
private String text;
|
||||
private int ordering;
|
||||
|
||||
public static CommonUseStatus getEnumById(String id) {
|
||||
return Arrays.stream(CommonUseStatus.values())
|
||||
.filter(x -> x.getId().equals(id))
|
||||
.findFirst()
|
||||
.orElse(CommonUseStatus.NOT_USE);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user