Fixed input parameters retrieval and CKAN translation

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-publishing/gCat-Feeder-Suite@179910 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Fabio Sinibaldi 2019-06-19 13:16:04 +00:00
parent 2b3f7f4cfd
commit c7e1990b19
5 changed files with 31 additions and 14 deletions

View File

@ -99,14 +99,27 @@ public class DMAlgorithmsInfoCollector implements DataCollector<InternalAlgorith
desc.setAuthor(parseUser(getAuthor(opDescription)));
desc.setMaintainer(parseUser(getAuthor(opDescription)));
// Parameters info
for(org.gcube.data.analysis.dataminermanagercl.shared.parameters.Parameter param:op.getOperatorParameters()) {
for(org.gcube.data.analysis.dataminermanagercl.shared.parameters.Parameter param:client.getInputParameters(op)) {
String paramDescription=param.getDescription();
String paramName=param.getName();
String paramType=param.getTypology().toString();
String paramValue=param.getValue();
desc.getParameters().add(
desc.getInputParameters().add(
new Parameter(paramName, paramType, paramDescription, paramValue));
}
for(org.gcube.data.analysis.dataminermanagercl.shared.parameters.Parameter param:client.getOutputParameters(op)) {
String paramDescription=param.getDescription();
String paramName=param.getName();
String paramType=param.getTypology().toString();
String paramValue=param.getValue();
desc.getOutputParameters().add(
new Parameter(paramName, paramType, paramDescription, paramValue));
}

View File

@ -34,7 +34,8 @@ public class InternalAlgorithmDescriptor implements CustomData {
private String categoryName;
private Set<Parameter> parameters=new HashSet<>();
private Set<Parameter> inputParameters=new HashSet<>();
private Set<Parameter> outputParameters=new HashSet<>();
private String guiLink;
private String wpsLink;

View File

@ -38,6 +38,7 @@ public class CkanItem {
private String license_id;
private String author;
private String maintainer;
private String notes;
private ArrayList<Tag> tags=new ArrayList<Tag>();
private ArrayList<CKanExtraField> extras=new ArrayList<>();

View File

@ -50,8 +50,15 @@ public class GCatModel implements CatalogueFormatData {
item.setPrivateFlag(desc.getPrivateFlag());
// TODO ADD PARAMETERS
for(Parameter param: desc.getParameters())
for(Parameter param: desc.getInputParameters())
item.getExtras().add(new CKanExtraField(profileID+":Input Parameter",
String.format("%1$s [%2$s] %3$s : %4$s",
param.getName(),param.getType(),
((param.getValue()!=null&&!param.getValue().isEmpty())?"default : "+param.getValue():""),
param.getDescription())));
for(Parameter param: desc.getOutputParameters())
item.getExtras().add(new CKanExtraField(profileID+":Input Parameter",
String.format("%1$s [%2$s] %3$s : %4$s",
param.getName(),param.getType(),
@ -60,7 +67,9 @@ public class GCatModel implements CatalogueFormatData {
//Algorithm Description
item.getExtras().add(new CKanExtraField(profileID+":Process Description", desc.getDescription()));
// item.getExtras().add(new CKanExtraField(profileID+":Process Description", desc.getDescription()));
item.setNotes(desc.getDescription());
// Algorithm Users
@ -68,7 +77,6 @@ public class GCatModel implements CatalogueFormatData {
item.getExtras().add(new CKanExtraField(profileID+":Process Author",desc.getAuthor().asStringValue()));
item.getExtras().add(new CKanExtraField(profileID+":Process Maintainer",desc.getAuthor().asStringValue()));
// TODO ADD RESOURCES
if(desc.getGuiLink()!=null)
resources.add(new CkanResource("Gateway Link",desc.getGuiLink(),"HTTP","Link to the GUI designed to operate with DataMiner"));
if(desc.getWpsLink()!=null)

View File

@ -4,13 +4,7 @@
<mandatory>false</mandatory>
<dataType>String</dataType>
<note>Input parameter expected for the execution of the process</note>
</metadatafield>
<metadatafield>
<fieldName>Process Description</fieldName>
<mandatory>false</mandatory>
<dataType>String</dataType>
<note>Input parameter expected for the execution of the process</note>
</metadatafield>
</metadatafield>
<metadatafield>
<fieldName>Output Parameter</fieldName>
<mandatory>false</mandatory>