Skip to content

Commit

Permalink
Adds name to EnumGroup and updates toString for EnumValue and EnumGro…
Browse files Browse the repository at this point in the history
…up (#5)

Signed-off-by: Sean Sundberg <[email protected]>
  • Loading branch information
seansund authored Jun 2, 2024
1 parent dc6f362 commit a469527
Show file tree
Hide file tree
Showing 22 changed files with 41 additions and 19 deletions.
16 changes: 16 additions & 0 deletions src/main/java/com/ibm/openpages/support/models/EnumGroup.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,15 @@

public class EnumGroup implements IEnumGroup {
private final List<EnumValue> values;
private final String name;

@Deprecated
public EnumGroup() {
this("<Unknown>");
}

public EnumGroup(String name) {
this.name = name;
this.values = new ArrayList<EnumValue>();
}

Expand All @@ -30,6 +37,11 @@ public EnumValue addEnumValue(String value, String label) {
return enumValue;
}

@Override
public String name() {
return name;
}

@Override
public List<EnumValue> values() {
return Collections.unmodifiableList(values);
Expand All @@ -45,4 +57,8 @@ public EnumValue[] valuesArray() {
public Optional<EnumValue> lookup(String value) {
return EnumUtil.lookup(valuesArray(), value);
}

public String toString() {
return "[EnumGroup: " + name + "]";
}
}
4 changes: 4 additions & 0 deletions src/main/java/com/ibm/openpages/support/models/EnumValue.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,8 @@ public String value() {
public IEnumGroup enumGroup() {
return enumGroup;
}

public String toString() {
return "[EnumValue: " + enumGroup + "." + value + " (" + label + ")]";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import java.util.Optional;

public interface IEnumGroup {
String name();

List<EnumValue> values();

EnumValue[] valuesArray();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import java.util.Optional;

public class Integration_Application {
protected static final EnumGroup eg = new EnumGroup();
protected static final EnumGroup eg = new EnumGroup("Application");

public static final EnumValue QRadar = eg.addEnumValue("QRadar");
public static final EnumValue WatsonKnowledgeCatalog = eg.addEnumValue("Watson Knowledge Catalog");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import java.util.Optional;

public class MRGAIFactsModelUseCase_RiskLevel {
protected static final EnumGroup eg = new EnumGroup();
protected static final EnumGroup eg = new EnumGroup("RiskLevel");

public static final EnumValue High = eg.addEnumValue("High");
public static final EnumValue Medium = eg.addEnumValue("Medium");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import java.util.Optional;

public class MRGAIFactsModelUseCase_Status {
protected static final EnumGroup eg = new EnumGroup();
protected static final EnumGroup eg = new EnumGroup("Status");

public static final EnumValue Proposed = eg.addEnumValue("Proposed");
public static final EnumValue AwaitingApproval = eg.addEnumValue("Awaiting Approval");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import java.util.Optional;

public class MRGModelUseCase_ExternallyFacing {
protected static final EnumGroup eg = new EnumGroup();
protected static final EnumGroup eg = new EnumGroup("ExternallyFacing");

public static final EnumValue Yes = eg.addEnumValue("Yes");
public static final EnumValue No = eg.addEnumValue("No");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import java.util.Optional;

public class MRGModelUseCase_UseCaseType {
protected static final EnumGroup eg = new EnumGroup();
protected static final EnumGroup eg = new EnumGroup("UseCaseType");

public static final EnumValue AI = eg.addEnumValue("AI");
public static final EnumValue NonAI = eg.addEnumValue("Non-AI");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import java.util.Optional;

public class MRGModelUseCase_UsesFoundationModels {
protected static final EnumGroup eg = new EnumGroup();
protected static final EnumGroup eg = new EnumGroup("UsesFoundationModels");

public static final EnumValue Yes = eg.addEnumValue("Yes");
public static final EnumValue No = eg.addEnumValue("No");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import java.util.Optional;

public class MRGModel_ApprovedTasks {
protected static final EnumGroup eg = new EnumGroup();
protected static final EnumGroup eg = new EnumGroup("ApprovedTasks");

public static final EnumValue Summarization = eg.addEnumValue("Summarization");
public static final EnumValue Classification = eg.addEnumValue("Classification");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import java.util.Optional;

public class MRGModel_BaselModel {
protected static final EnumGroup eg = new EnumGroup();
protected static final EnumGroup eg = new EnumGroup("BaselModel");

public static final EnumValue Yes = eg.addEnumValue("Yes");
public static final EnumValue No = eg.addEnumValue("No");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import java.util.Optional;

public class MRGModel_CandidateStatus {
protected static final EnumGroup eg = new EnumGroup();
protected static final EnumGroup eg = new EnumGroup("CandidateStatus");

public static final EnumValue ModelCandidate = eg.addEnumValue("Model Candidate");
public static final EnumValue CandidateAwaitingConfirmation = eg.addEnumValue("Candidate- Awaiting Confirmation");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import java.util.Optional;

public class MRGModel_ComplianceStatus {
protected static final EnumGroup eg = new EnumGroup();
protected static final EnumGroup eg = new EnumGroup("ComplianceStatus");

public static final EnumValue Compliant = eg.addEnumValue("Compliant");
public static final EnumValue PartiallyCompliant = eg.addEnumValue("Partially Compliant");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import java.util.Optional;

public class MRGModel_ExternalModel {
protected static final EnumGroup eg = new EnumGroup();
protected static final EnumGroup eg = new EnumGroup("ExternalModel");

public static final EnumValue External = eg.addEnumValue("External (Yes)");
public static final EnumValue Internal = eg.addEnumValue("Internal (No)");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import java.util.Optional;

public class MRGModel_MachineLearningModel {
protected static final EnumGroup eg = new EnumGroup();
protected static final EnumGroup eg = new EnumGroup("MachineLearningModel");

public static final EnumValue Yes = eg.addEnumValue("Yes");
public static final EnumValue No = eg.addEnumValue("No");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import java.util.Optional;

public class MRGModel_MeasurementType {
protected static final EnumGroup eg = new EnumGroup();
protected static final EnumGroup eg = new EnumGroup("MeasurementType");

public static final EnumValue EconomicCapital = eg.addEnumValue("Economic Capital");
public static final EnumValue ProbabilityOfDefault = eg.addEnumValue("Probability of Default");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import java.util.Optional;

public class OPLCQAssessment_LCName {
protected static final EnumGroup eg = new EnumGroup();
protected static final EnumGroup eg = new EnumGroup("LCName");

public static final EnumValue TwoStage = eg.addEnumValue("2Stage", "2 Stage Lifecycle (no review)");
public static final EnumValue ThreeStage = eg.addEnumValue("3Stage", "3 Stage Lifecycle (with review)");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import java.util.Optional;

public class OPLCQAssessment_LCStage {
protected static final EnumGroup eg = new EnumGroup();
protected static final EnumGroup eg = new EnumGroup("LCStage");

public static final EnumValue TwoStageInfo = eg.addEnumValue("2Stage-Info", "Information Gathering");
public static final EnumValue TwoStageClose = eg.addEnumValue("2Stage-Close", "Close");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import java.util.Optional;

public class OPLCQAssessment_LCStatus {
protected static final EnumGroup eg = new EnumGroup();
protected static final EnumGroup eg = new EnumGroup("LCStatus");

public static final EnumValue Complete = eg.addEnumValue("Complete");
public static final EnumValue InReview = eg.addEnumValue("InReview");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import java.util.Optional;

public class OPLCQAssessment_LCTransition {
protected static final EnumGroup eg = new EnumGroup();
protected static final EnumGroup eg = new EnumGroup("LCTransition");

public static final EnumValue TwoStageInfoSubmit = eg.addEnumValue("2Stage-Info-Submit", "Submit and Close");
public static final EnumValue ThreeStageInfoSubmit = eg.addEnumValue("3Stage-Info-Submit", "Submit");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import java.util.Optional;

public class OPLCStd_LCUpdateAssignee {
protected static final EnumGroup eg = new EnumGroup();
protected static final EnumGroup eg = new EnumGroup("LCUpdateAssignee");

public static final EnumValue Yes = eg.addEnumValue("Yes");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import java.util.Optional;

public class WatsonxQAssessment_AIAssessmentType {
protected static final EnumGroup eg = new EnumGroup();
protected static final EnumGroup eg = new EnumGroup("AIAssessmentType");

public static final EnumValue NotDetermined = eg.addEnumValue("Not Determined");
public static final EnumValue DataGathering = eg.addEnumValue("Data Gathering");
Expand Down

0 comments on commit a469527

Please sign in to comment.