Skip to content

Commit

Permalink
Renamed function type to name
Browse files Browse the repository at this point in the history
  • Loading branch information
cgendreau committed Nov 19, 2024
1 parent 42ad21e commit 8cea595
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/api.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Optionally, some functions can be used on columns to create new calculated colum
[source, json]
----
{
"columnFunctions":{"latLong":{"type":"CONVERT_COORDINATES_DD","params":["collectingEvent.eventGeom"]}}
"columnFunctions":{"latLong":{"functionName":"CONVERT_COORDINATES_DD","params":["collectingEvent.eventGeom"]}}
}
----

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class DataExport implements DinaEntity {

public enum ExportStatus { NEW, RUNNING, COMPLETED, EXPIRED, ERROR }
public enum ExportType { TABULAR_DATA, OBJECT_ARCHIVE }
public enum FunctionType { CONCAT, CONVERT_COORDINATES_DD }
public enum FunctionName { CONCAT, CONVERT_COORDINATES_DD }

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
Expand Down Expand Up @@ -96,6 +96,6 @@ public enum FunctionType { CONCAT, CONVERT_COORDINATES_DD }
@Transient
private Map<String, String> transitiveData;

public record FunctionDef(FunctionType type, List<String> params) {
public record FunctionDef(FunctionName functionName, List<String> params) {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ private void processRecord(String documentId, JsonNode record,
// Check if we have functions to apply
if (MapUtils.isNotEmpty(columnFunctions)) {
for (var functionDef : columnFunctions.entrySet()) {
switch (functionDef.getValue().type()) {
switch (functionDef.getValue().functionName()) {
case CONCAT -> attributeObjNode.put(functionDef.getKey(),
handleConcatFunction(attributeObjNode, functionDef.getValue().params()));
case CONVERT_COORDINATES_DD -> attributeObjNode.put(functionDef.getKey(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public void testESDatasource() throws IOException {
.columns(List.of("id", "materialSampleName", "collectingEvent.dwcVerbatimLocality",
"dwcCatalogNumber", "dwcOtherCatalogNumbers", "managedAttributes.attribute_1",
"collectingEvent.managedAttributes.attribute_ce_1", "projects.name", "latLong"))
.columnFunctions(Map.of("latLong", new DataExport.FunctionDef(DataExport.FunctionType.CONVERT_COORDINATES_DD, List.of("collectingEvent.eventGeom"))))
.columnFunctions(Map.of("latLong", new DataExport.FunctionDef(DataExport.FunctionName.CONVERT_COORDINATES_DD, List.of("collectingEvent.eventGeom"))))
.build());
assertNotNull(dto.getUuid());

Expand Down

0 comments on commit 8cea595

Please sign in to comment.