// Path: src/main/java/com/tw/go/plugins/artifactory/task/config/ConfigElement.java
// public abstract class ConfigElement<T> {
//     public static ConfigElement<UriConfig> uriConfig = new UriConfigElement();
//     public static ConfigElement<String> path = new PathConfigElement();
//     public static ConfigElement<Map<String, String>> buildProperties = new BuildPropertiesConfigElement();
// 
//     public List<String> names;
// 
//     protected ConfigElement(String... name) {
//         this.names = asList(name);
//     }
// 
//     public void addTo(TaskConfig taskConfig) {
//         for (String name : names) {
//             taskConfig.addProperty(name);
//         }
//     }
// 
//     public abstract T from(TaskConfig taskConfig);
//     public abstract Optional<ValidationError> validate(TaskConfig taskConfig);
// }
// 
// Path: src/main/java/com/tw/go/plugins/artifactory/task/view/TemplateBasedTaskView.java
// public class TemplateBasedTaskView implements TaskView {
//     private final Logger logger = Logger.getLogger(this.getClass());
// 
//     private final String title;
//     private final String template;
//     private final ClasspathResource classpathResource;
// 
//     public TemplateBasedTaskView(String title, String template) {
//         this.title = title;
//         this.template = template;
//         this.classpathResource = new ClasspathResource();
//     }
// 
//     @Override
//     public String displayValue() {
//         return title;
//     }
// 
//     @Override
//     public String template() {
//         try {
//             return classpathResource.read(templatePath());
//         } catch (IOException e) {
//             String message = format("Could not load view template [%s]!", template);
//             logger.error(message, e);
//             return message;
//         }
//     }
// 
//     private String templatePath() {
//         return format("view/%s.html", template);
//     }
// }


import com.google.common.base.Optional;
import com.thoughtworks.go.plugin.api.response.validation.ValidationError;
import com.thoughtworks.go.plugin.api.response.validation.ValidationResult;
import com.thoughtworks.go.plugin.api.task.Task;
import com.thoughtworks.go.plugin.api.task.TaskConfig;
import com.thoughtworks.go.plugin.api.task.TaskView;
import com.tw.go.plugins.artifactory.task.config.ConfigElement;
import com.tw.go.plugins.artifactory.task.view.TemplateBasedTaskView;
import java.util.List;
package com.tw.go.plugins.artifactory.task;



public abstract class GenericTask implements Task {
    private List<? extends ConfigElement> configs;

    public GenericTask(List<? extends ConfigElement> configs) {
        this.configs = configs;
    }

    @Override
    public final TaskConfig config() {
        TaskConfig taskConfig = new TaskConfig();

        for (ConfigElement config : configs) {
            config.addTo(taskConfig);
        }
        return taskConfig;
    }

    @Override
    public final ValidationResult validate(TaskConfig taskConfig) {
        ValidationResult result = new ValidationResult();

// Path: src/main/java/com/tw/go/plugins/artifactory/task/config/ConfigElement.java
// public abstract class ConfigElement<T> {
//     public static ConfigElement<UriConfig> uriConfig = new UriConfigElement();
//     public static ConfigElement<String> path = new PathConfigElement();
//     public static ConfigElement<Map<String, String>> buildProperties = new BuildPropertiesConfigElement();
// 
//     public List<String> names;
// 
//     protected ConfigElement(String... name) {
//         this.names = asList(name);
//     }
// 
//     public void addTo(TaskConfig taskConfig) {
//         for (String name : names) {
//             taskConfig.addProperty(name);
//         }
//     }
// 
//     public abstract T from(TaskConfig taskConfig);
//     public abstract Optional<ValidationError> validate(TaskConfig taskConfig);
// }
// 
// Path: src/main/java/com/tw/go/plugins/artifactory/task/view/TemplateBasedTaskView.java
// public class TemplateBasedTaskView implements TaskView {
//     private final Logger logger = Logger.getLogger(this.getClass());
// 
//     private final String title;
//     private final String template;
//     private final ClasspathResource classpathResource;
// 
//     public TemplateBasedTaskView(String title, String template) {
//         this.title = title;
//         this.template = template;
//         this.classpathResource = new ClasspathResource();
//     }
// 
//     @Override
//     public String displayValue() {
//         return title;
//     }
// 
//     @Override
//     public String template() {
//         try {
//             return classpathResource.read(templatePath());
//         } catch (IOException e) {
//             String message = format("Could not load view template [%s]!", template);
//             logger.error(message, e);
//             return message;
//         }
//     }
// 
//     private String templatePath() {
//         return format("view/%s.html", template);
//     }
// }


// Path: src/main/java/com/tw/go/plugins/artifactory/task/GenericTask.java
import com.google.common.base.Optional;
import com.thoughtworks.go.plugin.api.response.validation.ValidationError;
import com.thoughtworks.go.plugin.api.response.validation.ValidationResult;
import com.thoughtworks.go.plugin.api.task.Task;
import com.thoughtworks.go.plugin.api.task.TaskConfig;
import com.thoughtworks.go.plugin.api.task.TaskView;
import com.tw.go.plugins.artifactory.task.config.ConfigElement;
import com.tw.go.plugins.artifactory.task.view.TemplateBasedTaskView;
import java.util.List;

package com.tw.go.plugins.artifactory.task;



public abstract class GenericTask implements Task {
    private List<? extends ConfigElement> configs;

    public GenericTask(List<? extends ConfigElement> configs) {
        this.configs = configs;
    }

    @Override
    public final TaskConfig config() {
        TaskConfig taskConfig = new TaskConfig();

        for (ConfigElement config : configs) {
            config.addTo(taskConfig);
        }
        return taskConfig;
    }

    @Override
    public final ValidationResult validate(TaskConfig taskConfig) {
        ValidationResult result = new ValidationResult();

        for (ConfigElement config : configs) {