taverna-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stain <...@git.apache.org>
Subject [GitHub] incubator-taverna-common-activities pull request #13: Taverna 3
Date Tue, 12 Jul 2016 19:59:33 GMT
Github user stain commented on a diff in the pull request:

    https://github.com/apache/incubator-taverna-common-activities/pull/13#discussion_r70510590
  
    --- Diff: taverna-cwl-activity-ui/src/main/java/org/apache/taverna/cwl/ui/serviceprovider/CwlServiceDesc.java
---
    @@ -16,79 +16,67 @@
      *******************************************************************************/
     package org.apache.taverna.cwl.ui.serviceprovider;
     
    -import java.util.Arrays;
     import java.util.List;
    -import java.util.Map;
     
     import javax.swing.Icon;
     
    -import org.apache.taverna.cwl.CwlActivityConfigurationBean;
     import org.apache.taverna.cwl.CwlDumyActivity;
     
    +import com.fasterxml.jackson.databind.JsonNode;
    +
     import net.sf.taverna.t2.servicedescriptions.ServiceDescription;
     import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
     
    -public class CwlServiceDesc extends ServiceDescription<CwlActivityConfigurationBean>
{
    +public class CwlServiceDesc extends ServiceDescription<JsonNode > {
     
     	private static final String DESCRIPTION = "description";
     
     	@Override
     	public String getDescription() {
    -		String description = (String) cwlConfiguration.get(DESCRIPTION);
    +	
     		//see  whether description is too long
    -		if (description == null || (description.length()>40))
    -			return "";
    +		if (cwlConfiguration.has(DESCRIPTION)){
    +			String description = cwlConfiguration.path(DESCRIPTION).asText();
    +				if((description.length()<40))return description;
    +				else return "";
    +		}
     		else
    -			return description;
    +			return "";
     	}
     
    -	private Map cwlConfiguration;
    -	private String toolName;
    +	private JsonNode cwlConfiguration;
     
    -	@Override
    -	public Class<? extends Activity<CwlActivityConfigurationBean>> getActivityClass()
{
    -		return (Class<? extends Activity<CwlActivityConfigurationBean>>) CwlDumyActivity.class;
    +	public void setCwlConfiguration(JsonNode cwlConfiguration) {
    +		//set yaml parse CWL tool content
    +		this.cwlConfiguration = cwlConfiguration;
     	}
     
    +	private String toolName;
    +
     	@Override
    -	public CwlActivityConfigurationBean getActivityConfiguration() {
    -		// Creating the CWL configuration bean
    -		CwlActivityConfigurationBean configurationBean = new CwlActivityConfigurationBean();
    -		configurationBean.setCwlConfigurations(cwlConfiguration);
    -		configurationBean.setToolName(toolName);
    -		return configurationBean;
    +	public Class<? extends Activity<JsonNode>> getActivityClass() {
    +		//should fix this
    +		return null;
     	}
    -
    -	public Map getCwlConfiguration() {
    +	@Override
    +	public JsonNode getActivityConfiguration() {
    --- End diff --
    
    +1 - except you will need to wrap it in a `Configuration` object like in [super.getActivityConfiguration](https://github.com/apache/incubator-taverna-workbench/blob/master/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/ServiceDescription.java#L48)
- so perhaps this would work:
    
    ```java
    @Override
    public Configuration getActivityConfiguration() {
      Configuration c = super.getActivityConfiguration();
      c.setJson(cwlConfiguration);
      return c;
    }
    ```
    
    (alternative use `c.getJsonAsObjectNode()` and manipulate it)
    
    The _configuration type_ (as opposed to the above _activity type_ can be the URI https://taverna.apache.org/ns/2016/activity/cwl#Config
- e.g. the default from the superclass.
    



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message