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.setAuthor(parseUser(getAuthor(opDescription)));
desc.setMaintainer(parseUser(getAuthor(opDescription))); desc.setMaintainer(parseUser(getAuthor(opDescription)));
// Parameters info // 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 paramDescription=param.getDescription();
String paramName=param.getName(); String paramName=param.getName();
String paramType=param.getTypology().toString(); String paramType=param.getTypology().toString();
String paramValue=param.getValue(); 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)); new Parameter(paramName, paramType, paramDescription, paramValue));
} }

View File

@ -34,7 +34,8 @@ public class InternalAlgorithmDescriptor implements CustomData {
private String categoryName; 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 guiLink;
private String wpsLink; private String wpsLink;

View File

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

View File

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

View File

@ -5,12 +5,6 @@
<dataType>String</dataType> <dataType>String</dataType>
<note>Input parameter expected for the execution of the process</note> <note>Input parameter expected for the execution of the process</note>
</metadatafield> </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> <fieldName>Output Parameter</fieldName>
<mandatory>false</mandatory> <mandatory>false</mandatory>