-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add extended property types #49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
07a6e1b
feat: add extended property types
bs-quantori 7885109
fix: make akka repo optional
bs-quantori 3ab86f0
Add a key to download Akka libraries.
bs-quantori 10bd2fc
fix: unblock CI builds
bs-quantori 3f9dec4
chore: align Akka repo usage
bs-quantori fc20593
chore: align module versions to 0.0.17
bs-quantori 29fd639
Fix build.
bs-quantori fd04ee9
fix: add AKKA env + property mapping meta
bs-quantori 20932a0
Fix build.
bs-quantori 2ea35b5
chore: enforce Akka repo fail-fast
bs-quantori 8e2d802
Fix build.
bs-quantori 601fb92
fix: read AKKA_REPO_URL property
bs-quantori fef1155
docs: clarify Akka repo resolution
bs-quantori 0b3278d
Fix build.
bs-quantori 038bbd8
Add package naming strategy to CONTEXT.md.
bs-quantori File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,4 +1,15 @@ | ||
| ## Build instructions | ||
| * Download the repository | ||
| * Let your IDE import necessary dependencies automatically or fetch them manually | ||
| * For local repository publication Run `gradle build` task and then run `gradle publishToMavenLocal` tasks | ||
| * For local repository publication run the following tasks | ||
| * `gradlew :cqp-api:build :cqp-api:publishToMavenLocal` | ||
| * `gradle build -x :cqp-api:build` | ||
| * `gradle publishToMavenLocal -x :cqp-api:publishToMavenLocal` | ||
|
|
||
| ## Repository configuration | ||
|
|
||
| * The shared plugin reads the Akka repository URL in this order and stops at the first match: | ||
| 1. Gradle property `AKKA_REPO_URL` (set via `gradle.properties` or `-PAKKA_REPO_URL=...`) | ||
| 2. Gradle property `akkaRepoUrl` (legacy camelCase fallback) | ||
| 3. Environment variable `AKKA_REPO_URL` | ||
| * If none of the above is supplied, the build fails immediately. Obtain the secure URL/token from https://account.akka.io/ and set one of the properties/variables before running Gradle. |
This file contains hidden or 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 hidden or 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
53 changes: 53 additions & 0 deletions
53
cqp-api/src/main/java/com/quantori/cqp/api/model/PropertyValue.java
This file contains hidden or 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,53 @@ | ||
| package com.quantori.cqp.api.model; | ||
|
|
||
| import java.time.Instant; | ||
| import java.time.LocalDate; | ||
| import java.util.List; | ||
| import lombok.AllArgsConstructor; | ||
| import lombok.Builder; | ||
| import lombok.Data; | ||
| import lombok.NoArgsConstructor; | ||
|
|
||
| /** | ||
| * Container for the value of a {@link Property}. Each concrete field maps to a {@link | ||
| * Property.PropertyType}. Only one field is expected to be non-null for a particular value. | ||
| */ | ||
| @Data | ||
| @NoArgsConstructor | ||
| @AllArgsConstructor | ||
| @Builder | ||
| public class PropertyValue { | ||
|
|
||
| /** String payload for {@link Property.PropertyType#STRING} values. */ | ||
| private String stringValue; | ||
|
|
||
| /** Decimal payload for {@link Property.PropertyType#DECIMAL} values. */ | ||
| private Double decimalValue; | ||
|
|
||
| /** Date payload for {@link Property.PropertyType#DATE} values. */ | ||
| private LocalDate dateValue; | ||
|
|
||
| /** | ||
| * Binary content for {@link Property.PropertyType#BINARY} values. Typical use cases include | ||
| * storing images or PDF attachments (up to 10 MB). | ||
| */ | ||
| private byte[] binaryValue; | ||
|
|
||
| /** Timestamp payload for {@link Property.PropertyType#DATE_TIME} values. */ | ||
| private Instant dateTimeValue; | ||
|
|
||
| /** Ordered collection of strings for {@link Property.PropertyType#LIST} values. */ | ||
| private List<String> listValue; | ||
|
|
||
| /** URL string for {@link Property.PropertyType#HYPERLINK} values. */ | ||
| private String hyperlinkValue; | ||
|
|
||
| /** SMILES payload for {@link Property.PropertyType#CHEMICAL_STRUCTURE} values. */ | ||
| private String chemicalStructureValue; | ||
|
|
||
| /** MOL block payload for {@link Property.PropertyType#STRUCTURE_3D} values. */ | ||
| private String structure3DValue; | ||
|
|
||
| /** Sanitized HTML fragment for {@link Property.PropertyType#HTML} values. */ | ||
| private String htmlValue; | ||
| } |
60 changes: 60 additions & 0 deletions
60
cqp-api/src/test/java/com/quantori/cqp/api/model/PropertyTypeTest.java
This file contains hidden or 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,60 @@ | ||
| package com.quantori.cqp.api.model; | ||
|
|
||
| import static org.assertj.core.api.Assertions.assertThat; | ||
|
|
||
| import java.time.Instant; | ||
| import java.time.LocalDate; | ||
| import java.util.EnumSet; | ||
| import java.util.List; | ||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| class PropertyTypeTest { | ||
|
|
||
| @Test | ||
| void shouldContainExtendedTypes() { | ||
| EnumSet<Property.PropertyType> types = EnumSet.allOf(Property.PropertyType.class); | ||
|
|
||
| assertThat(types) | ||
| .contains( | ||
| Property.PropertyType.BINARY, | ||
| Property.PropertyType.DATE_TIME, | ||
| Property.PropertyType.LIST, | ||
| Property.PropertyType.HYPERLINK, | ||
| Property.PropertyType.CHEMICAL_STRUCTURE, | ||
| Property.PropertyType.STRUCTURE_3D, | ||
| Property.PropertyType.HTML); | ||
| } | ||
|
|
||
| @Test | ||
| void shouldAllowPropertyValueAccessors() { | ||
| byte[] binary = new byte[] {1, 2, 3}; | ||
| Instant timestamp = Instant.parse("2024-01-01T10:15:30Z"); | ||
| List<String> orderedList = List.of("first", "second"); | ||
| LocalDate date = LocalDate.of(2024, 2, 29); | ||
|
|
||
| PropertyValue value = | ||
| PropertyValue.builder() | ||
| .stringValue("test") | ||
| .decimalValue(12.34d) | ||
| .dateValue(date) | ||
| .binaryValue(binary) | ||
| .dateTimeValue(timestamp) | ||
| .listValue(orderedList) | ||
| .hyperlinkValue("https://example.com") | ||
| .chemicalStructureValue("CCO") | ||
| .structure3DValue("3D-MOL-DATA") | ||
| .htmlValue("<p>html</p>") | ||
| .build(); | ||
|
|
||
| assertThat(value.getStringValue()).isEqualTo("test"); | ||
| assertThat(value.getDecimalValue()).isEqualTo(12.34d); | ||
| assertThat(value.getDateValue()).isEqualTo(date); | ||
| assertThat(value.getBinaryValue()).containsExactly(binary); | ||
| assertThat(value.getDateTimeValue()).isEqualTo(timestamp); | ||
| assertThat(value.getListValue()).containsExactlyElementsOf(orderedList); | ||
| assertThat(value.getHyperlinkValue()).isEqualTo("https://example.com"); | ||
| assertThat(value.getChemicalStructureValue()).isEqualTo("CCO"); | ||
| assertThat(value.getStructure3DValue()).isEqualTo("3D-MOL-DATA"); | ||
| assertThat(value.getHtmlValue()).isEqualTo("<p>html</p>"); | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.