Project

General

Profile

« Previous | Next » 

Revision 41480

Repo HI

View differences:

RepoInternalController.java
28 28
import eu.dnetlib.enabling.datasources.rmi.RepositoryMapEntry;
29 29
import eu.dnetlib.enabling.datasources.rmi.SearchInterfacesEntry;
30 30
import eu.dnetlib.enabling.datasources.rmi.SimpleDatasourceDesc;
31
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService;
32
import eu.dnetlib.enabling.is.registry.rmi.ISRegistryService;
33 31
import eu.dnetlib.enabling.locators.UniqueServiceLocator;
32
import eu.dnetlib.functionality.modular.ui.AbstractAjaxController;
34 33
import eu.dnetlib.functionality.modular.ui.repositories.util.RepoUIUtils;
35 34
import eu.dnetlib.functionality.modular.ui.workflows.objects.sections.WorkflowSectionGrouper;
36 35
import eu.dnetlib.msro.workflows.procs.WorkflowExecutor;
......
38 37
import net.sf.ehcache.Element;
39 38

  
40 39
@Controller
41
public class RepoInternalController {
40
public class RepoInternalController extends AbstractAjaxController {
42 41

  
43 42
	@Resource
44 43
	private UniqueServiceLocator serviceLocator;
......
93 92
		return this.serviceLocator.getService(DatasourceManagerService.class).simpleListDatasourcesByType(type);
94 93
	}
95 94

  
96
	@RequestMapping(value = "/ui/validateRepo.do")
97
	public @ResponseBody String listRepositories(@RequestParam(value = "id", required = true) final String id,
98
			@RequestParam(value = "b", required = true) final boolean b) throws Exception {
99

  
100
		final String query = "count(/*[.//RESOURCE_TYPE/@value='WorkflowDSResourceType' and .//DATASOURCE/@id='" + id + "'])";
101
		if (!b && Integer.parseInt(this.serviceLocator.getService(ISLookUpService.class).getResourceProfileByQuery(query)) > 0) { throw new Exception(
102
				"Repo " + id + " can be invalidated: it is related to some wfs"); }
103

  
104
		final String newId = b ? this.serviceLocator.getService(ISRegistryService.class).validateProfile(id)
105
				: this.serviceLocator.getService(ISRegistryService.class).invalidateProfile(id);
106

  
107
		this.repoUIJsonCache.removeAll();
108

  
109
		return newId;
110
	}
111

  
112 95
	@SuppressWarnings("unchecked")
113 96
	@RequestMapping("/ui/repo/repoApi.update")
114 97
	public @ResponseBody boolean updateRepoApi(

Also available in: Unified diff