All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.molgenis.script.ScriptPluginController Maven / Gradle / Ivy

There is a newer version: 8.4.5
Show newest version
package org.molgenis.script;

import static java.util.stream.Collectors.toList;
import static org.molgenis.script.ScriptPluginController.URI;

import org.molgenis.data.DataService;
import org.molgenis.ui.MolgenisPluginController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
@RequestMapping(URI)
public class ScriptPluginController extends MolgenisPluginController
{
	public static final String ID = "scripts";
	public static final String URI = MolgenisPluginController.PLUGIN_URI_PREFIX + ID;
	private final DataService dataService;

	@Autowired
	public ScriptPluginController(DataService dataService)
	{
		super(URI);
		this.dataService = dataService;
	}

	@RequestMapping(method = RequestMethod.GET)
	public String listScripts(Model model)
	{

		model.addAttribute("scripts", dataService.findAll(Script.ENTITY_NAME, Script.class).collect(toList()));
		model.addAttribute("parameters",
				dataService.findAll(ScriptParameter.ENTITY_NAME, ScriptParameter.class).collect(toList()));
		return "view-scripts";
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy