Skip to content

Commit

Permalink
Merge pull request #81 from aodn/features/add-contacts#5667
Browse files Browse the repository at this point in the history
add contacts field
  • Loading branch information
HavierD authored Jun 19, 2024
2 parents 62d8b4a + 269ff44 commit 24ce917
Show file tree
Hide file tree
Showing 9 changed files with 73 additions and 15 deletions.
14 changes: 10 additions & 4 deletions indexer/src/main/java/au/org/aodn/esindexer/utils/MapperUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,16 @@ public static class Contacts {
protected LinkedHashSet<LinkModel> onlineResources = new LinkedHashSet<>();
}

public static String mapContactsRole(CIResponsibilityType2 ciResponsibility) {
CodeListValueType roleCode = ciResponsibility.getRole().getCIRoleCode();
return roleCode != null ?
roleCode.getCodeListValue() : "";
public static List<String> mapContactsRole(CIResponsibilityType2 ciResponsibility) {
if (
ciResponsibility == null
|| ciResponsibility.getRole() == null
|| ciResponsibility.getRole().getCIRoleCode() == null
|| ciResponsibility.getRole().getCIRoleCode().getCodeListValue() == null
) {
return Collections.emptyList();
}
return Collections.singletonList(ciResponsibility.getRole().getCIRoleCode().getCodeListValue());
}

public static String mapContactsOrganization(AbstractCIPartyPropertyType2 party) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,59 @@
}
}
}
},
"contacts": {
"type": "nested",
"properties": {
"contact": {
"type": "nested",
"properties": {
"name": { "type": "text" },
"organization": { "type": "text" },
"position": { "type": "text" },
"phones": {
"type": "nested",
"properties": {
"value": { "type": "text" },
"roles": { "type": "text" }
}
},
"emails": {
"type": "nested",
"properties": {
"value": { "type": "text" },
"roles": { "type": "text" }
}
},
"addresses": {
"type": "nested",
"properties": {
"delivery_point": { "type": "text" },
"city": { "type": "text" },
"administrative_area": { "type": "text" },
"postal_code": { "type": "text" },
"country": { "type": "text" }
}
},
"links": {
"type": "nested",
"properties": {
"link" : {
"type": "nested",
"properties": {
"href": { "type": "text" },
"rel": { "type": "text" },
"type": { "type": "text" },
"title": { "type": "text" },
"description": { "type": "text" }
}
}
}
},
"roles": { "type": "text" }
}
}
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions indexer/src/test/resources/canned/sample4_stac.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
},
"contacts": [
{
"roles": "principalInvestigator",
"roles": ["principalInvestigator"],
"organization": "CSIRO Oceans and Atmosphere - Hobart",
"name": "Lenton, Andrew",
"position": "",
Expand All @@ -112,7 +112,7 @@
"links": []
},
{
"roles": "pointOfContact",
"roles": ["pointOfContact"],
"organization": "Integrated Marine Observing System (IMOS)",
"name": "",
"position": "Data Officer",
Expand Down
2 changes: 1 addition & 1 deletion indexer/src/test/resources/canned/sample5_stac.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
},
"contacts": [
{
"roles": "pointOfContact",
"roles": ["pointOfContact"],
"organization": "Integrated Marine Observing System (IMOS)",
"name": "",
"position": "Data Officer",
Expand Down
2 changes: 1 addition & 1 deletion indexer/src/test/resources/canned/sample6_stac.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
},
"contacts": [
{
"roles": "custodian",
"roles": ["custodian"],
"organization": "CSIRO Oceans & Atmosphere - Hobart",
"name": "[email protected],",
"position": "Data Requests - Information & Data Centre",
Expand Down
4 changes: 2 additions & 2 deletions indexer/src/test/resources/canned/sample7_stac.json
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@
},
"contacts": [
{
"roles": "principalInvestigator",
"roles": ["principalInvestigator"],
"organization": "Australian Institute of Marine Science (AIMS)",
"name": "Remmers T",
"position": "",
Expand Down Expand Up @@ -231,7 +231,7 @@
]
},
{
"roles": "pointOfContact",
"roles": ["pointOfContact"],
"organization": "Australian Institute of Marine Science (AIMS)",
"name": "AIMS Data Centre",
"position": "",
Expand Down
2 changes: 1 addition & 1 deletion indexer/src/test/resources/canned/sample8_stac.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
},
"contacts": [
{
"roles": "pointOfContact",
"roles": ["pointOfContact"],
"organization": "CSIRO Oceans & Atmosphere - Hobart",
"name": "CSIRO O&A, Information & Data Centre",
"position": "Data Requests",
Expand Down
4 changes: 2 additions & 2 deletions indexer/src/test/resources/canned/sample9_stac.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
},
"contacts": [
{
"roles": "principalInvestigator",
"roles": ["principalInvestigator"],
"organization": "Australian Institute of Marine Science (AIMS)",
"name": "Quigley, KM",
"position": "",
Expand Down Expand Up @@ -121,7 +121,7 @@
]
},
{
"roles": "pointOfContact",
"roles": ["pointOfContact"],
"organization": "Australian Institute of Marine Science (AIMS)",
"name": "AIMS Data Centre",
"position": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@

import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;

@Data
@Builder
public class ContactsModel {
protected String roles;
protected List<String> roles;
protected String organization;
protected String name;
protected String position;
Expand Down

0 comments on commit 24ce917

Please sign in to comment.