Implementing solution based on freemarker

This commit is contained in:
Luca Frosini 2023-04-11 18:00:37 +02:00
parent 07ce42c4bf
commit a4f5143647
4 changed files with 76 additions and 1 deletions

View File

@ -33,6 +33,13 @@ public class FreeMarkerTest {
ObjectMapper mapper = new ObjectMapper();
Map map = mapper.readValue(json, Map.class);
map.put("uri_resolver_base_url", "https://data.d4science.org/ctlg/GRSF_Admin");
map.put("include_sensitive", true);
/**
* We can also use this in template
* <#assign uri_resolver_base_url="https://data.d4science.org/ctlg/GRSF_Admin">
* <#assign include_sensitive=true>
*/
File out = new File(FreeMarker.getResourcesDirectory(), json.getName());
out.delete();

View File

@ -1,2 +1,3 @@
/FARM.gcubekey
/token.properties
/config.properties

View File

@ -3,23 +3,39 @@
"license_id": "${license_id}",
"description": "Short Name: ${short_name}\nGRSF Semantic Identifier: ${grsf_semantic_identifier}\nRecord URL: ${uri_resolver_base_url}/${grsf_uuid}",
"tags" : [
<#if assessment_area??>
<#list assessment_area as aa>
{
"name": "${aa}"
},
</#list>
</#if>
{
"name": "${grsf_type?capitalize}"
},
<#if species??>
<#list species as s>
{
"name": "${s}"
},
</#list>
</#if>
{
"name": "${similarities_indicator}"
}
],
"extras": [
<#if assessment_area??>
<#list assessment_area as aa>
{
"key": "stock_identity:Assessment Area",
"value": "${aa}"
},
</#list>
</#if>
<#if connected??>
<#list connected as connected_record>
@ -30,12 +46,47 @@
</#list>
</#if>
<#if database_sources??>
<#list database_sources as database_source>
{
"key": "stock_identity:Database Source",
"value": "${database_source.name}"
},
</#list>
</#if>
<#if similar_grsf_record??>
<#list similar_grsf_record as sgr>
{
"key": "stock_identity:Similar GRSF Record",
"value": "${sgr}"
},
</#list>
</#if>
<#if species??>
<#list species as s>
{
"key": "stock_identity:stock_identity:Species",
"value": "${s}"
},
</#list>
</#if>
<#if abundance_level?? && include_sensitive>
<#list abundance_level[0..*5] as al>
{
"key": "stock_data:Abundance Level",
"value" "${al.value} [<#if al.unit?has_content>Unit: ${al.unit} - </#if><#if al.reporting_year_or_assessment_id?has_content>Rep. Year or Assessment Id: ${al.reporting_year_or_assessment_id} - </#if><#if al.reference_year?has_content>Ref. Year: ${al.reference_year} - </#if><#if al.data_owner?has_content>Data Owner: ${al.data_owner} - </#if><#if al.db_source?has_content>DB Source: ${al.db_source}</#if>]"
},
</#list>
</#if>
{
"key": "stock_identity:GRSF Stock Name",
@ -49,10 +100,22 @@
"key": "stock_identity:GRSF Semantic Identifier",
"value": "${grsf_semantic_identifier}"
},
{
"key": "stock_identity:GRSF Type",
"value": "${grsf_type?capitalize}"
},
{
"key": "system:type",
"value": "${grsf_type?capitalize}"
},
{
"key": "Record URL",
"value": "${uri_resolver_base_url}/${grsf_uuid}"
}
}
]
}

View File

@ -4,6 +4,10 @@
{
"name": "uri_resolver_base_url",
"value": "https://data.d4science.org/ctlg/GRSF_Admin"
},
{
"name": "include_sensitive",
"value": true
}
]
},