This repository has been archived by the owner on Apr 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 50
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 #1447 from cdowding-sl/feature/profile-update/data…
…-types Added DTO Type Enums
- Loading branch information
Showing
14 changed files
with
169 additions
and
117 deletions.
There are no files selected for viewing
69 changes: 69 additions & 0 deletions
69
common/src/main/java/com/scottlogic/deg/common/profile/ConstraintType.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,69 @@ | ||
package com.scottlogic.deg.common.profile; | ||
|
||
public enum ConstraintType | ||
{ | ||
EQUAL_TO("equalTo"), | ||
IN_SET("inSet"), | ||
IN_MAP("inMap"), | ||
NULL("null"), | ||
GRANULAR_TO("granularTo"), | ||
MATCHES_REGEX("matchingRegex"), | ||
CONTAINS_REGEX("containingRegex"), | ||
OF_LENGTH("ofLength"), | ||
LONGER_THAN("longerThan"), | ||
SHORTER_THAN("shorterThan"), | ||
GREATER_THAN("greaterThan"), | ||
GREATER_THAN_OR_EQUAL_TO("greaterThanOrEqualTo"), | ||
LESS_THAN("lessThan"), | ||
LESS_THAN_OR_EQUAL_TO("lessThanOrEqualTo"), | ||
AFTER("after"), | ||
AFTER_OR_AT("afterOrAt"), | ||
BEFORE("before"), | ||
BEFORE_OR_AT("beforeOrAt"), | ||
NOT("not"), | ||
ANY_OF("anyOf"), | ||
ALL_OF("allOf"), | ||
CONDITION("condition"); | ||
|
||
private final String type; | ||
|
||
ConstraintType(String name) | ||
{ | ||
this.type = name; | ||
} | ||
|
||
public String getType() | ||
{ | ||
return type; | ||
} | ||
|
||
public static ConstraintType fromString(String type){ | ||
switch (type) | ||
{ | ||
case "equalTo": return EQUAL_TO; | ||
case "inSet": return IN_SET; | ||
case "inMap": return IN_MAP; | ||
case "null": return NULL; | ||
case "granularTo": return GRANULAR_TO; | ||
case "matchingRegex": return MATCHES_REGEX; | ||
case "containingRegex": return CONTAINS_REGEX; | ||
case "ofLength": return OF_LENGTH; | ||
case "longerThan": return LONGER_THAN; | ||
case "shorterThan": return SHORTER_THAN; | ||
case "greaterThan": return GREATER_THAN; | ||
case "greaterThanOrEqualTo": return GREATER_THAN_OR_EQUAL_TO; | ||
case "lessThan": return LESS_THAN; | ||
case "lessThanOrEqualTo": return LESS_THAN_OR_EQUAL_TO; | ||
case "after": return AFTER; | ||
case "afterOrAt": return AFTER_OR_AT; | ||
case "before": return BEFORE; | ||
case "beforeOrAt": return BEFORE_OR_AT; | ||
case "not": return NOT; | ||
case "anyOf": return ANY_OF; | ||
case "allOf": return ALL_OF; | ||
case "condition": return CONDITION; | ||
default: | ||
throw new IllegalStateException("No constraint types with name " + type); | ||
} | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
common/src/main/java/com/scottlogic/deg/common/profile/SpecificFieldType.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,56 @@ | ||
package com.scottlogic.deg.common.profile; | ||
|
||
import com.fasterxml.jackson.annotation.JsonValue; | ||
|
||
public enum SpecificFieldType | ||
{ | ||
DECIMAL("decimal", FieldType.NUMERIC), | ||
INTEGER( "integer", FieldType.NUMERIC), | ||
ISIN("ISIN", FieldType.STRING), | ||
SEDOL("SEDOL", FieldType.STRING), | ||
CUSIP("CUSIP", FieldType.STRING), | ||
RIC("RIC", FieldType.STRING), | ||
FIRST_NAME("firstname", FieldType.STRING), | ||
LAST_NAME("lastname", FieldType.STRING), | ||
FULL_NAME("fullname", FieldType.STRING), | ||
STRING("string", FieldType.STRING), | ||
DATETIME("datetime", FieldType.DATETIME); | ||
|
||
@JsonValue | ||
private final String type; | ||
private final FieldType fieldType; | ||
|
||
SpecificFieldType(String type, FieldType fieldType) | ||
{ | ||
this.type = type; | ||
this.fieldType = fieldType; | ||
} | ||
|
||
public String getType() { | ||
return type; | ||
} | ||
|
||
public FieldType getFieldType() | ||
{ | ||
return fieldType; | ||
} | ||
|
||
public static SpecificFieldType from(String type){ | ||
switch (type) | ||
{ | ||
case "decimal": return DECIMAL; | ||
case "integer": return INTEGER; | ||
case "ISIN": return ISIN; | ||
case "SEDOL": return SEDOL; | ||
case "CUSIP": return CUSIP; | ||
case "RIC": return RIC; | ||
case "firstname": return FIRST_NAME; | ||
case "lastname": return LAST_NAME; | ||
case "fullname": return FULL_NAME; | ||
case "string": return STRING; | ||
case "datetime": return DATETIME; | ||
default: | ||
throw new IllegalStateException("No data types with type " + type); | ||
} | ||
} | ||
} |
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
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
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.