Added method to discriminated between valid and not valid item statuses
This commit is contained in:
parent
54c79bc12c
commit
452cf085bf
|
@ -8,10 +8,10 @@ import java.util.Map;
|
||||||
*/
|
*/
|
||||||
public enum CMItemStatus {
|
public enum CMItemStatus {
|
||||||
|
|
||||||
PENDING("pending"),
|
PENDING("pending", true),
|
||||||
APPROVED("approved"),
|
APPROVED("approved", true),
|
||||||
REJECTED("rejected"),
|
REJECTED("rejected", true),
|
||||||
ANY("*");
|
ANY("*", false);
|
||||||
|
|
||||||
protected static final Map<String,CMItemStatus> CM_ITEM_STATUS_FROM_VALUE;
|
protected static final Map<String,CMItemStatus> CM_ITEM_STATUS_FROM_VALUE;
|
||||||
|
|
||||||
|
@ -25,14 +25,16 @@ public enum CMItemStatus {
|
||||||
|
|
||||||
protected final String value;
|
protected final String value;
|
||||||
protected final String fancyValue;
|
protected final String fancyValue;
|
||||||
|
protected final boolean validStatus;
|
||||||
|
|
||||||
private CMItemStatus(String value) {
|
private CMItemStatus(String value, boolean validStatus) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
if(this.value.length()>1) {
|
if(this.value.length()>1) {
|
||||||
this.fancyValue = Character.toUpperCase(value.charAt(0)) + value.substring(1);
|
this.fancyValue = Character.toUpperCase(value.charAt(0)) + value.substring(1);
|
||||||
}else {
|
}else {
|
||||||
this.fancyValue = this.value;
|
this.fancyValue = this.value;
|
||||||
}
|
}
|
||||||
|
this.validStatus = validStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getValue() {
|
public String getValue() {
|
||||||
|
@ -43,9 +45,12 @@ public enum CMItemStatus {
|
||||||
return fancyValue;
|
return fancyValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isValidStatus() {
|
||||||
|
return validStatus;
|
||||||
|
}
|
||||||
|
|
||||||
public static CMItemStatus getCMItemStatusFromValue(String value) {
|
public static CMItemStatus getCMItemStatusFromValue(String value) {
|
||||||
return CM_ITEM_STATUS_FROM_VALUE.get(value);
|
return CM_ITEM_STATUS_FROM_VALUE.get(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue