Project

General

Profile

« Previous | Next » 

Revision 33642

[maven-release-plugin] copy for tag dnet-modular-is-ui-2.0.2

View differences:

modules/dnet-modular-is-ui/tags/dnet-modular-is-ui-2.0.2/deploy.info
1
{"type_source": "SVN", "goal": "package -U -T 4C source:jar", "url": "http://svn-public.driver.research-infrastructures.eu/driver/dnet40/modules/dnet-modular-is-ui/trunk/", "deploy_repository": "dnet4-snapshots", "version": "4", "mail": "sandro.labruzzo@isti.cnr.it,michele.artini@isti.cnr.it, claudio.atzori@isti.cnr.it, alessia.bardi@isti.cnr.it", "deploy_repository_url": "http://maven.research-infrastructures.eu/nexus/content/repositories/dnet4-snapshots", "name": "dnet-modular-is-ui"}
modules/dnet-modular-is-ui/tags/dnet-modular-is-ui-2.0.2/src/main/java/eu/dnetlib/functionality/modular/ui/is/InformationServiceEntryPointController.java
1
package eu.dnetlib.functionality.modular.ui.is;
2

  
3
import javax.servlet.http.HttpServletRequest;
4
import javax.servlet.http.HttpServletResponse;
5

  
6
import org.springframework.ui.ModelMap;
7

  
8
import eu.dnetlib.functionality.modular.ui.ModuleEntryPoint;
9

  
10
public class InformationServiceEntryPointController extends ModuleEntryPoint {
11

  
12
	@Override
13
	protected void initialize(final ModelMap map, final HttpServletRequest request, final HttpServletResponse response) throws Exception {
14

  
15
	}
16

  
17
}
modules/dnet-modular-is-ui/tags/dnet-modular-is-ui-2.0.2/src/main/java/eu/dnetlib/functionality/modular/ui/is/InformationServiceInternalController.java
1
package eu.dnetlib.functionality.modular.ui.is;
2

  
3
import java.io.IOException;
4
import java.io.StringReader;
5
import java.util.Collections;
6
import java.util.List;
7
import java.util.Map;
8

  
9
import javax.annotation.Resource;
10
import javax.servlet.ServletOutputStream;
11
import javax.servlet.ServletResponse;
12

  
13
import org.apache.commons.io.IOUtils;
14
import org.apache.commons.lang.StringUtils;
15
import org.apache.commons.lang.math.NumberUtils;
16
import org.apache.commons.logging.Log;
17
import org.apache.commons.logging.LogFactory;
18
import org.dom4j.Document;
19
import org.dom4j.io.SAXReader;
20
import org.springframework.stereotype.Controller;
21
import org.springframework.web.bind.annotation.RequestMapping;
22
import org.springframework.web.bind.annotation.RequestParam;
23
import org.springframework.web.bind.annotation.ResponseBody;
24

  
25
import com.google.common.collect.Lists;
26
import com.google.common.collect.Maps;
27

  
28
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpDocumentNotFoundException;
29
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException;
30
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService;
31
import eu.dnetlib.enabling.is.registry.rmi.ISRegistryService;
32
import eu.dnetlib.enabling.locators.UniqueServiceLocator;
33
import eu.dnetlib.functionality.modular.ui.AbstractAjaxController;
34
import eu.dnetlib.functionality.modular.ui.is.bulk.ProfileImporter;
35
import eu.dnetlib.functionality.modular.ui.is.objects.BlackboardMessage;
36
import eu.dnetlib.functionality.modular.ui.is.objects.CollectionDesc;
37

  
38
@Controller
39
public class InformationServiceInternalController extends AbstractAjaxController {
40

  
41
	@Resource
42
	private UniqueServiceLocator serviceLocator;
43

  
44
	@Resource(name = "modularUiProfileImporter")
45
	private ProfileImporter profileImporter;
46

  
47
	private static final Log log = LogFactory.getLog(InformationServiceInternalController.class);
48

  
49
	@RequestMapping("/ui/is/xquery.do")
50
	public @ResponseBody List<String> query(@RequestParam(value = "query", required = true) final String query) throws Exception {
51
		log.debug("Executing xquery: " + query);
52
		return serviceLocator.getService(ISLookUpService.class).quickSearchProfile(query);
53
	}
54

  
55
	@RequestMapping("/ui/is/listSchemas.do")
56
	public @ResponseBody List<String> listSchemas() throws Exception {
57
		return serviceLocator.getService(ISLookUpService.class).listResourceTypes();
58
	}
59

  
60
	@RequestMapping("/ui/is/getSchema.do")
61
	public @ResponseBody String getSchema(@RequestParam(value = "name", required = true) final String name) throws Exception {
62
		return serviceLocator.getService(ISLookUpService.class).getResourceTypeSchema(name);
63
	}
64

  
65
	@RequestMapping("/ui/is/listCollections.do")
66
	public @ResponseBody List<CollectionDesc> listCollections() throws Exception {
67
		final String xquery = "for $kind in xmldb:get-child-collections('/db/DRIVER') " +
68
				"for $type in xmldb:get-child-collections(concat('/db/DRIVER/', $kind)) " +
69
				"return concat ($kind, ' @@@ ', $type, ' @@@ ', count(xmldb:get-child-resources(concat('/db/DRIVER/', $kind, '/', $type))))";
70

  
71
		final Map<String, CollectionDesc> map = Maps.newHashMap();
72
		for (String s : serviceLocator.getService(ISLookUpService.class).quickSearchProfile(xquery)) {
73
			final String[] arr = s.split("@@@");
74
			final String kind = arr[0].trim();
75
			final String type = arr[1].trim();
76
			final int size = NumberUtils.toInt(arr[2].trim(), 0);
77
			if (!map.containsKey(kind)) {
78
				map.put(kind, new CollectionDesc(kind));
79
			}
80
			map.get(kind).addType(type, size);
81
		}
82

  
83
		final List<CollectionDesc> res = Lists.newArrayList(map.values());
84
		for (CollectionDesc d : res) {
85
			Collections.sort(d.getTypes());
86
		}
87
		Collections.sort(res);
88

  
89
		return res;
90
	}
91

  
92
	@RequestMapping("/ui/is/listProfiles.do")
93
	public @ResponseBody List<String> listProfiles(@RequestParam(value = "kind", required = true) final String kind,
94
			@RequestParam(value = "type", required = true) final String type) throws Exception {
95
		final String collName = "/db/DRIVER/" + kind + "/" + type;
96
		final String xquery = "distinct-values(for $x in collection('" + collName + "') return $x//RESOURCE_IDENTIFIER/@value/string())";
97
		final List<String> res = serviceLocator.getService(ISLookUpService.class).quickSearchProfile(xquery);
98

  
99
		Collections.sort(res);
100

  
101
		return res;
102
	}
103

  
104
	@RequestMapping("/ui/is/getProfile.do")
105
	public @ResponseBody String getProfiles(@RequestParam(value = "id", required = true) final String id) throws Exception {
106
		return serviceLocator.getService(ISLookUpService.class).getResourceProfile(id);
107
	}
108

  
109
	@RequestMapping("/ui/is/registerProfile.do")
110
	public @ResponseBody String registerProfile(@RequestParam(value = "profile", required = true) final String profile) throws Exception {
111
		return serviceLocator.getService(ISRegistryService.class).registerProfile(profile);
112
	}
113

  
114
	@RequestMapping("/ui/is/updateProfile.do")
115
	public @ResponseBody String updateProfile(@RequestParam(value = "profile", required = true) final String profile) throws Exception {
116
		final SAXReader reader = new SAXReader();
117
		final Document doc = reader.read(new StringReader(profile));
118

  
119
		final String id = doc.valueOf("//RESOURCE_IDENTIFIER/@value");
120
		final String type = doc.valueOf("//RESOURCE_TYPE/@value");
121

  
122
		if (StringUtils.isEmpty(id)) {
123
			throw new Exception("RESOURCE_IDENTIFIER is empty");
124
		} else if (StringUtils.isEmpty(type)) {
125
			throw new Exception("RESOURCE_TYPE is empty");
126
		} else if (serviceLocator.getService(ISRegistryService.class).updateProfile(id, profile, type)) {
127
			return id;
128
		} else {
129
			throw new Exception("Profile not updated");
130
		}
131
	}
132

  
133
	@RequestMapping("/ui/is/deleteProfile.do")
134
	public @ResponseBody boolean deleteProfile(@RequestParam(value = "id", required = true) final String id) throws Exception {
135
		return serviceLocator.getService(ISRegistryService.class).deleteProfile(id);
136
	}
137

  
138
	@RequestMapping("/ui/is/import.do")
139
	public @ResponseBody Map<String, Integer> importProfiles(
140
			@RequestParam(value = "path", required = true) final String path,
141
			@RequestParam(value = "profiles", required = true) final boolean profiles,
142
			@RequestParam(value = "schemas", required = true) final boolean schemas) throws Exception {
143

  
144
		log.info("importing profiles/schemas from " + path);
145

  
146
		final Map<String, Integer> res = Maps.newHashMap();
147
		if (schemas) {
148
			res.putAll(profileImporter.importSchemas(path + "/**/*.xsd"));
149
		}
150
		if (profiles) {
151
			res.putAll(profileImporter.importProfiles(path + "/**/*.xml"));
152
		}
153

  
154
		return res;
155
	}
156

  
157
	@RequestMapping("/ui/is/listBlackboards.do")
158
	public @ResponseBody List<BlackboardMessage> listBlackboards() throws Exception {
159
		final List<BlackboardMessage> list = Lists.newArrayList();
160

  
161
		final SAXReader reader = new SAXReader();
162

  
163
		for (String xml : serviceLocator
164
				.getService(ISLookUpService.class)
165
				.quickSearchProfile(
166
						"for $x in collection('/db/DRIVER/ServiceResources')//MESSAGE return <message>{$x/../../..//RESOURCE_TYPE}{$x/../../..//RESOURCE_IDENTIFIER}{$x}</message>")) {
167
			final BlackboardMessage info = new BlackboardMessage();
168
			final Document doc = reader.read(new StringReader(xml));
169
			info.setProfId(doc.valueOf(".//RESOURCE_IDENTIFIER/@value"));
170
			info.setMessageId(doc.valueOf(".//@id"));
171
			info.setResourceType(doc.valueOf(".//RESOURCE_TYPE/@value"));
172
			info.setAction(doc.valueOf(".//ACTION"));
173
			info.setDate(doc.valueOf(".//@date"));
174
			info.setActionStatus(doc.valueOf(".//ACTION_STATUS"));
175
			info.setError(doc.valueOf(".//PARAMETER[@name='error']/@value"));
176
			list.add(info);
177
		}
178
		return list;
179
	}
180

  
181
	@RequestMapping("/ui/is/getMetaWfIdForFamily.do")
182
	public @ResponseBody Map<String, String> getMetaWfId(@RequestParam(value = "family", required = true) final String family) throws ISLookUpException {
183
		final String xq = "for $x in collection('/db/DRIVER/MetaWorkflowDSResources/MetaWorkflowDSResourceType') " +
184
				"where $x//METAWORKFLOW_NAME/@family='" + family + "' " +
185
				"return concat($x//RESOURCE_IDENTIFIER/@value, ' @@@ ', $x//METAWORKFLOW_SECTION)";
186

  
187
		final Map<String, String> map = Maps.newHashMap();
188
		try {
189
			final String[] arr = serviceLocator.getService(ISLookUpService.class).getResourceProfileByQuery(xq).split("@@@");
190
			map.put("id", arr[0].trim());
191
			map.put("section", arr[1].trim());
192
		} catch (ISLookUpDocumentNotFoundException e) {
193
			map.put("id", "");
194
			map.put("section", "");
195
		}
196
		map.put("family", family);
197

  
198
		return map;
199
	}
200

  
201
	public void sendXML(final ServletResponse response, final String xml) throws IOException {
202
		response.setContentType("text/xml");
203

  
204
		final ServletOutputStream out = response.getOutputStream();
205
		IOUtils.copy(new StringReader(xml), out);
206

  
207
		out.flush();
208
		out.close();
209
	}
210
}
modules/dnet-modular-is-ui/tags/dnet-modular-is-ui-2.0.2/src/main/java/eu/dnetlib/functionality/modular/ui/is/objects/BlackboardMessage.java
1
package eu.dnetlib.functionality.modular.ui.is.objects;
2

  
3
public class BlackboardMessage {
4
	private String profId;
5
	private String messageId;
6
	private String resourceType; 
7
	private String action;
8
	private String date;
9
	private String actionStatus;
10
	private String error;
11
	
12
	public BlackboardMessage() {}
13
	
14
	public BlackboardMessage(String profId, String messageId, String resourceType,	String action, String date, String actionStatus, String error) {
15
		this.profId = profId;
16
		this.messageId = messageId;
17
		this.resourceType = resourceType;
18
		this.action = action;
19
		this.date = date;
20
		this.actionStatus = actionStatus;
21
		this.error = error;
22
	}
23

  
24
	public String getProfId() {
25
		return profId;
26
	}
27

  
28
	public void setProfId(String profId) {
29
		this.profId = profId;
30
	}
31

  
32
	public String getMessageId() {
33
		return messageId;
34
	}
35

  
36
	public void setMessageId(String messageId) {
37
		this.messageId = messageId;
38
	}
39

  
40
	public String getResourceType() {
41
		return resourceType;
42
	}
43

  
44
	public void setResourceType(String resourceType) {
45
		this.resourceType = resourceType;
46
	}
47

  
48
	public String getAction() {
49
		return action;
50
	}
51

  
52
	public void setAction(String action) {
53
		this.action = action;
54
	}
55

  
56
	public String getDate() {
57
		return date;
58
	}
59

  
60
	public void setDate(String date) {
61
		this.date = date;
62
	}
63

  
64
	public String getActionStatus() {
65
		return actionStatus;
66
	}
67

  
68
	public void setActionStatus(String actionStatus) {
69
		this.actionStatus = actionStatus;
70
	}
71

  
72
	public String getError() {
73
		return error;
74
	}
75

  
76
	public void setError(String error) {
77
		this.error = error;
78
	}
79
}
modules/dnet-modular-is-ui/tags/dnet-modular-is-ui-2.0.2/src/main/java/eu/dnetlib/functionality/modular/ui/is/objects/CollectionDesc.java
1
package eu.dnetlib.functionality.modular.ui.is.objects;
2

  
3
import java.util.ArrayList;
4
import java.util.List;
5

  
6
import com.google.common.collect.Lists;
7

  
8
public class CollectionDesc implements Comparable<CollectionDesc> {
9
	private String kind;
10
	private int size = 0;
11
	private List<CollectionTypeDesc> types = Lists.newArrayList();
12
	
13
	public CollectionDesc() {}
14
	
15
	public CollectionDesc(String kind, List<CollectionTypeDesc> types, int size) {
16
		this.kind = kind;
17
		this.types = types;
18
		this.size = size;
19
	}
20
	
21
	public CollectionDesc(String kind) {
22
		this(kind, new ArrayList<CollectionTypeDesc>(), 0);
23
	}
24

  
25
	public String getKind() {
26
		return kind;
27
	}
28
	
29
	public void setKind(String kind) {
30
		this.kind = kind;
31
	}
32
	
33
	public List<CollectionTypeDesc> getTypes() {
34
		return types;
35
	}
36
	
37
	public void setTypes(List<CollectionTypeDesc> types) {
38
		this.types = types;
39
	}
40

  
41
	public void addType(String type, int n) {
42
		types.add(new CollectionTypeDesc(type, n));
43
		this.size += n;
44
	}
45
	
46
	public int getSize() {
47
		return size;
48
	}
49

  
50
	public void setSize(int size) {
51
		this.size = size;
52
	}
53

  
54
	@Override
55
	public int compareTo(CollectionDesc o) {
56
		return kind.compareTo(o.getKind());
57
	}
58

  
59
}
modules/dnet-modular-is-ui/tags/dnet-modular-is-ui-2.0.2/src/main/java/eu/dnetlib/functionality/modular/ui/is/objects/CollectionTypeDesc.java
1
package eu.dnetlib.functionality.modular.ui.is.objects;
2

  
3
public class CollectionTypeDesc implements Comparable<CollectionTypeDesc> {
4
	private String name;
5
	private int size;
6
	
7
	public CollectionTypeDesc() {}
8
	
9
	public CollectionTypeDesc(String name, int size) {
10
		this.name = name;
11
		this.size = size;
12
	}
13
	
14
	public String getName() {
15
		return name;
16
	}
17
	
18
	public void setName(String name) {
19
		this.name = name;
20
	}
21
	
22
	public int getSize() {
23
		return size;
24
	}
25
	
26
	public void setSize(int size) {
27
		this.size = size;
28
	}
29

  
30
	@Override
31
	public int compareTo(CollectionTypeDesc o) {
32
		return name.compareTo(o.getName());
33
	}
34

  
35
}
modules/dnet-modular-is-ui/tags/dnet-modular-is-ui-2.0.2/src/main/java/eu/dnetlib/functionality/modular/ui/is/bulk/ProfileImporter.java
1
package eu.dnetlib.functionality.modular.ui.is.bulk;
2

  
3
import java.io.IOException;
4
import java.net.URL;
5
import java.util.Map;
6

  
7
import org.apache.commons.io.FilenameUtils;
8
import org.apache.commons.io.IOUtils;
9
import org.apache.commons.logging.Log;
10
import org.apache.commons.logging.LogFactory;
11
import org.springframework.context.ResourceLoaderAware;
12
import org.springframework.core.io.Resource;
13
import org.springframework.core.io.ResourceLoader;
14
import org.springframework.core.io.support.ResourcePatternUtils;
15

  
16
import com.google.common.collect.Maps;
17

  
18
import eu.dnetlib.enabling.is.registry.rmi.ISRegistryService;
19
import eu.dnetlib.enabling.is.store.rmi.ISStoreService;
20
import eu.dnetlib.enabling.locators.UniqueServiceLocator;
21
import eu.dnetlib.enabling.tools.StreamOpaqueResource;
22

  
23
public class ProfileImporter implements ResourceLoaderAware {
24

  
25
	private ResourceLoader resourceLoader;
26

  
27
	private static final Log log = LogFactory.getLog(ProfileImporter.class);
28

  
29
	@javax.annotation.Resource
30
	private UniqueServiceLocator serviceLocator;
31

  
32
	public Map<String, Integer> importSchemas(final String path) throws IOException {
33

  
34
		int done = 0;
35
		int total = 0;
36

  
37
		for (Resource res : ResourcePatternUtils.getResourcePatternResolver(getResourceLoader()).getResources(path)) {
38
			total++;
39
			try {
40
				registerSchema(res.getURL());
41
				done++;
42
			} catch (Throwable e) {
43
				log.error("Error registering schema " + res.getURL(), e);
44
			}
45
		}
46

  
47
		final Map<String, Integer> res = Maps.newHashMap();
48
		res.put("schemasDone", done);
49
		res.put("schemasTotal", total);
50

  
51
		return res;
52
	}
53

  
54
	public Map<String, Integer> importProfiles(final String path) throws IOException {
55

  
56
		int done = 0;
57
		int total = 0;
58

  
59
		for (Resource res : ResourcePatternUtils.getResourcePatternResolver(getResourceLoader()).getResources(path)) {
60
			total++;
61
			try {
62
				registerProfile(res.getURL());
63
				done++;
64
			} catch (Throwable e) {
65
				log.error("Error registering profile " + res.getURL(), e);
66
			}
67
		}
68

  
69
		final Map<String, Integer> res = Maps.newHashMap();
70
		res.put("profilesDone", done);
71
		res.put("profilesTotal", total);
72

  
73
		return res;
74
	}
75

  
76
	private void registerSchema(final URL url) throws Exception {
77
		final String resourceType = FilenameUtils.getBaseName(url.getPath());
78

  
79
		log.info("registering schema: " + resourceType);
80

  
81
		serviceLocator.getService(ISRegistryService.class).addResourceType(resourceType, IOUtils.toString(url.openStream()));
82
	}
83

  
84
	private void registerProfile(final URL url) throws Exception {
85
		final StreamOpaqueResource resource = new StreamOpaqueResource(url.openStream());
86
		final String name = resource.getResourceId().split("_")[0];
87
		final String coll = "/db/DRIVER/" + resource.getResourceKind() + "/" + resource.getResourceType();
88

  
89
		log.info("saving profile: " + name + " in coll " + coll);
90

  
91
		serviceLocator.getService(ISStoreService.class).insertXML(name, coll, resource.asString());
92
	}
93

  
94
	public ResourceLoader getResourceLoader() {
95
		return resourceLoader;
96
	}
97

  
98
	@Override
99
	public void setResourceLoader(final ResourceLoader resourceLoader) {
100
		this.resourceLoader = resourceLoader;
101
	}
102

  
103
}
modules/dnet-modular-is-ui/tags/dnet-modular-is-ui-2.0.2/src/main/resources/eu/dnetlib/functionality/modular/ui/webContext-modular-ui-is.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<beans xmlns="http://www.springframework.org/schema/beans"
3
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"
4
	xmlns:sec="http://cxf.apache.org/configuration/security" xmlns:wsa="http://cxf.apache.org/ws/addressing"
5
	xmlns:p="http://www.springframework.org/schema/p" xmlns:http="http://cxf.apache.org/transports/http/configuration"
6
	xmlns:t="http://dnetlib.eu/springbeans/t" xmlns:template="http://dnetlib.eu/springbeans/template"
7
	xmlns:util="http://www.springframework.org/schema/util" xmlns:context="http://www.springframework.org/schema/context"
8
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
9
						http://cxf.apache.org/ws/addressing http://cxf.apache.org/schemas/ws-addr-conf.xsd
10
						http://cxf.apache.org/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd
11
						http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd
12
						http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
13
						http://dnetlib.eu/springbeans/template http://dnetlib.eu/springbeans/template.xsd
14
						http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
15
						http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
16

  
17

  
18
	<bean name="/ui/isManager.do"
19
		class="eu.dnetlib.functionality.modular.ui.is.InformationServiceEntryPointController"
20
		p:menu="Information Service Inspector" 
21
		p:title="Information Service Inspector"
22
		p:description="Information Service Inspector"
23
		p:order="1" 
24
		p:group="Tools">
25
		<property name="permissionLevels">
26
			<set>
27
				<value>IS_ADMIN</value>
28
			</set>
29
		</property>
30
	</bean>
31

  
32
</beans>
modules/dnet-modular-is-ui/tags/dnet-modular-is-ui-2.0.2/src/main/resources/eu/dnetlib/functionality/modular/ui/applicationContext-modular-ui-is.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<beans xmlns="http://www.springframework.org/schema/beans"
3
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"
4
	xmlns:sec="http://cxf.apache.org/configuration/security" xmlns:wsa="http://cxf.apache.org/ws/addressing"
5
	xmlns:p="http://www.springframework.org/schema/p" xmlns:http="http://cxf.apache.org/transports/http/configuration"
6
	xmlns:t="http://dnetlib.eu/springbeans/t" xmlns:template="http://dnetlib.eu/springbeans/template"
7
	xmlns:util="http://www.springframework.org/schema/util" xmlns:context="http://www.springframework.org/schema/context"
8
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
9
						http://cxf.apache.org/ws/addressing http://cxf.apache.org/schemas/ws-addr-conf.xsd
10
						http://cxf.apache.org/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd
11
						http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd
12
						http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
13
						http://dnetlib.eu/springbeans/template http://dnetlib.eu/springbeans/template.xsd
14
						http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
15
						http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
16

  
17
	<bean id="modularUiProfileImporter" class="eu.dnetlib.functionality.modular.ui.is.bulk.ProfileImporter" />
18
						
19
</beans>
modules/dnet-modular-is-ui/tags/dnet-modular-is-ui-2.0.2/src/main/resources/eu/dnetlib/functionality/modular/ui/views/ui/isManager.st
1
$common/master( header={
2
	<script type="text/javascript" src="../resources/js/angular.min.js" ></script>
3
	<script type="text/javascript" src="../resources/js/angular-route.min.js"></script>
4
	<script type="text/javascript" src="../resources/js/angular-local-storage.min.js"></script>
5
	<script type="text/javascript" src="../resources/js/is_manager.js"></script>
6
	<script type="text/javascript" src="../resources/js/is_manager_controllers.js"></script>
7
}, body={
8
	<div ng-app="isManager" class="row">
9
		<div class="col-sm-3 col-lg-2" ng-controller="moduleMenuCtrl">
10
			<ul class="nav nav-pills nav-stacked">
11
				<li ng-class="{active : isActive('^\/(list|profile|profiles)')}"><a href="#/list">Profiles</a></li>
12
				<li ng-class="{active : isActive('^\/(schemas|schema)')}"><a href="#/schemas">Schemas</a></li>
13
				<li ng-class="{active : isActive('^\/q')}"><a href="#/q">XQuery</a></li>
14
				<li ng-class="{active : isActive('^\/register')}"><a href="#/register">Register new profile</a></li>
15
				<li ng-class="{active : isActive('^\/bulk')}"><a href="#/bulk">Bulk importer</a></li>
16
				<li ng-class="{active : isActive('^\/verify')}"><a href="#/verify">Validation checker</a></li>
17
				<li ng-class="{active : isActive('^\/subscriptions')}"><a href="#/subscriptions">Subscriptions</a></li>
18
				<li ng-class="{active : isActive('^\/blackboard')}"><a href="#/blackboard">Blackboard messages</a></li>
19
				<li ng-class="{active : isActive('^\/backup')}"><a href="#/backup">Backup</a></li>
20
			</ul>
21
		</div>
22
		<div ng-view class="col-sm-9 col-lg-10"></div>
23
	</div>
24
} )$
modules/dnet-modular-is-ui/tags/dnet-modular-is-ui-2.0.2/src/main/resources/eu/dnetlib/functionality/modular/workflows/backup/backup-metawf.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<RESOURCE_PROFILE>
3
	<HEADER>
4
		<RESOURCE_IDENTIFIER
5
			value="f9c630f2-29f9-4196-a75f-1d208d7ef6dc_TWV0YVdvcmtmbG93RFNSZXNvdXJjZXMvTWV0YVdvcmtmbG93RFNSZXNvdXJjZVR5cGU=" />
6
		<RESOURCE_TYPE value="MetaWorkflowDSResourceType" />
7
		<RESOURCE_KIND value="MetaWorkflowDSResources" />
8
		<RESOURCE_URI value="" />
9
		<DATE_OF_CREATION value="2014-07-29T10:15:51.0Z" />
10
	</HEADER>
11
	<BODY>
12
		<METAWORKFLOW_NAME family="IS_BACKUP">Backup</METAWORKFLOW_NAME>
13
		<METAWORKFLOW_DESCRIPTION />
14
		<METAWORKFLOW_SECTION>Information Service</METAWORKFLOW_SECTION>
15
		<ADMIN_EMAIL />
16
		<CONFIGURATION status="EXECUTABLE">
17
			<WORKFLOW name="IS-Store Backup"
18
				id="8426b094-1f35-471e-8431-e75732dfa134_V29ya2Zsb3dEU1Jlc291cmNlcy9Xb3JrZmxvd0RTUmVzb3VyY2VUeXBl">
19
				<WORKFLOW name="IS-SN Backup"
20
					id="c245e501-a19d-4647-bd9f-68e5db522a5a_V29ya2Zsb3dEU1Jlc291cmNlcy9Xb3JrZmxvd0RTUmVzb3VyY2VUeXBl" />
21
			</WORKFLOW>
22
		</CONFIGURATION>
23
		<SCHEDULING enabled="false">
24
			<CRON>29 5 22 ? * *</CRON>
25
			<MININTERVAL>10080</MININTERVAL>
26
		</SCHEDULING>
27
	</BODY>
28
</RESOURCE_PROFILE>
modules/dnet-modular-is-ui/tags/dnet-modular-is-ui-2.0.2/src/main/resources/eu/dnetlib/functionality/modular/workflows/backup/backup-isstore.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<RESOURCE_PROFILE xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
3
	<HEADER>
4
		<RESOURCE_IDENTIFIER
5
			value="8426b094-1f35-471e-8431-e75732dfa134_V29ya2Zsb3dEU1Jlc291cmNlcy9Xb3JrZmxvd0RTUmVzb3VyY2VUeXBl" />
6
		<RESOURCE_TYPE value="WorkflowDSResourceType" />
7
		<RESOURCE_KIND value="WorkflowDSResources" />
8
		<RESOURCE_URI value="" />
9
		<DATE_OF_CREATION value="2014-07-29T10:15:51.0Z" />
10
	</HEADER>
11
	<BODY>
12
		<WORKFLOW_NAME>IS-Store Backup</WORKFLOW_NAME>
13
		<WORKFLOW_TYPE>IS_BACKUP</WORKFLOW_TYPE>
14
		<WORKFLOW_PRIORITY>20</WORKFLOW_PRIORITY>
15
		<CONFIGURATION start="auto">
16
			<NODE name="backup" isStart="true">
17
				<DESCRIPTION>Perform the backup of the IS-Store</DESCRIPTION>
18
				<PARAMETERS />
19
				<ARCS>
20
					<ARC to="success" />
21
				</ARCS>
22
			</NODE>
23
		</CONFIGURATION>
24
		<STATUS />
25
	</BODY>
26
</RESOURCE_PROFILE>
modules/dnet-modular-is-ui/tags/dnet-modular-is-ui-2.0.2/src/main/resources/eu/dnetlib/functionality/modular/workflows/backup/backup-issn.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<RESOURCE_PROFILE xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
3
	<HEADER>
4
		<RESOURCE_IDENTIFIER
5
			value="c245e501-a19d-4647-bd9f-68e5db522a5a_V29ya2Zsb3dEU1Jlc291cmNlcy9Xb3JrZmxvd0RTUmVzb3VyY2VUeXBl" />
6
		<RESOURCE_TYPE value="WorkflowDSResourceType" />
7
		<RESOURCE_KIND value="WorkflowDSResources" />
8
		<RESOURCE_URI value="" />
9
		<DATE_OF_CREATION value="2014-07-29T10:15:51.0Z" />
10
	</HEADER>
11
	<BODY>
12
		<WORKFLOW_NAME>IS-SN Backup</WORKFLOW_NAME>
13
		<WORKFLOW_TYPE>IS_BACKUP</WORKFLOW_TYPE>
14
		<WORKFLOW_PRIORITY>20</WORKFLOW_PRIORITY>
15
		<CONFIGURATION start="auto">
16
			<NODE name="backup" isStart="true">
17
				<DESCRIPTION>Perform the backup of the IS-SN</DESCRIPTION>
18
				<PARAMETERS />
19
				<ARCS>
20
					<ARC to="success" />
21
				</ARCS>
22
			</NODE>
23
		</CONFIGURATION>
24
		<STATUS />
25
	</BODY>
26
</RESOURCE_PROFILE>
modules/dnet-modular-is-ui/tags/dnet-modular-is-ui-2.0.2/src/main/resources/eu/dnetlib/functionality/modular/workflows/validation/validation.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<RESOURCE_PROFILE xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
3
	<HEADER>
4
		<RESOURCE_IDENTIFIER
5
			value="54898c83-8dcd-4cfb-b092-8ba6697f658b_V29ya2Zsb3dEU1Jlc291cmNlcy9Xb3JrZmxvd0RTUmVzb3VyY2VUeXBl" />
6
		<RESOURCE_TYPE value="WorkflowDSResourceType" />
7
		<RESOURCE_KIND value="WorkflowDSResources" />
8
		<RESOURCE_URI value="" />
9
		<DATE_OF_CREATION value="2014-07-29T10:15:51.0Z" />
10
	</HEADER>
11
	<BODY>
12
		<WORKFLOW_NAME>Revalidate profiles</WORKFLOW_NAME>
13
		<WORKFLOW_TYPE>IS_VALIDATION</WORKFLOW_TYPE>
14
		<WORKFLOW_PRIORITY>20</WORKFLOW_PRIORITY>
15
		<CONFIGURATION start="auto">
16
			<NODE name="Validate" type="ValidateProfiles" isStart="true">
17
				<DESCRIPTION>Perform the validation of the IS Profiles</DESCRIPTION>
18
				<PARAMETERS />
19
				<ARCS>
20
					<ARC to="success" />
21
				</ARCS>
22
			</NODE>
23
		</CONFIGURATION>
24
		<STATUS />
25
	</BODY>
26
</RESOURCE_PROFILE>
modules/dnet-modular-is-ui/tags/dnet-modular-is-ui-2.0.2/src/main/resources/eu/dnetlib/functionality/modular/workflows/validation/validation-metawf.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<RESOURCE_PROFILE>
3
	<HEADER>
4
		<RESOURCE_IDENTIFIER
5
			value="e5288425-c599-4194-80d1-62c51d526b34_TWV0YVdvcmtmbG93RFNSZXNvdXJjZXMvTWV0YVdvcmtmbG93RFNSZXNvdXJjZVR5cGU=" />
6
		<RESOURCE_TYPE value="MetaWorkflowDSResourceType" />
7
		<RESOURCE_KIND value="MetaWorkflowDSResources" />
8
		<RESOURCE_URI value="" />
9
		<DATE_OF_CREATION value="2014-07-29T10:15:51.0Z" />
10
	</HEADER>
11
	<BODY>
12
		<METAWORKFLOW_NAME family="IS_VALIDATION">Revalidate profiles</METAWORKFLOW_NAME>
13
		<METAWORKFLOW_DESCRIPTION />
14
		<METAWORKFLOW_SECTION>Information Service</METAWORKFLOW_SECTION>
15
		<ADMIN_EMAIL />
16
		<CONFIGURATION status="EXECUTABLE">
17
			<WORKFLOW name="Revalidate profiles"
18
				id="54898c83-8dcd-4cfb-b092-8ba6697f658b_V29ya2Zsb3dEU1Jlc291cmNlcy9Xb3JrZmxvd0RTUmVzb3VyY2VUeXBl" />
19
		</CONFIGURATION>
20
		<SCHEDULING enabled="false">
21
			<CRON>29 5 22 ? * *</CRON>
22
			<MININTERVAL>10080</MININTERVAL>
23
		</SCHEDULING>
24
	</BODY>
25
</RESOURCE_PROFILE>
modules/dnet-modular-is-ui/tags/dnet-modular-is-ui-2.0.2/src/main/resources/eu/dnetlib/web/resources/html/is/bulk.html
1
<div class="well">
2
	<fieldset>
3
		<legend><h4>Bulk Importer</h4></legend>
4
		<form role="form">
5
			<div class="form-group">
6
				<label for="bulkPathInput" class="control-label">BaseURL Directory:</label>
7
				<input type="text" class="form-control" id="bulkPathInput" ng-model="path" />
8
			</div>
9
			<div class="checkbox" style="margin-top: 20px">
10
				<label>
11
					<input type="checkbox" ng-model="profiles" /> <b>Import profiles:</b> <i>{{path}}/**/*.xml</i>
12
				</label>
13
			</div>
14
			<div class="checkbox" style="margin-top: 20px;">
15
				<label>
16
					<input type="checkbox" ng-model="schemas" /> <b>Import schemas:</b> <i>{{path}}/**/*.xsd</i>
17
				</label>
18
			</div>
19
			<div style="margin-top: 30px;">
20
				<b>Examples:</b>
21
				<pre>file:///tmp/dnet_import			
22
classpath*:/eu/dnetlib/test (use CAREFULLY to reload default profiles and schemas)</pre>
23
			</div>
24
			<button class="btn btn-default" ng-click="bulkImport()" style="margin-top: 30px;">Import</button>
25
		</form>
26
		
27
		<table class="table" ng-show="(response.schemasTotal != null) || (response.profilesTotal != null)">
28
			<thead>
29
				<tr>
30
					<th></th>
31
					<th class="text-center col-xs-3">Total</th>
32
					<th class="text-center col-xs-3">Added</th>
33
					<th class="text-center col-xs-3">Discarded</th>
34
				</tr>
35
			</thead>
36
			<tbody>
37
				<tr ng-show="response.schemasTotal != null">
38
					<th>Schemas</th>
39
					<td class="text-center col-xs-1">{{response.schemasTotal}}</td>
40
					<td class="text-center col-xs-1">{{response.schemasDone}}</td>
41
					<td class="text-center col-xs-1" ng-class="{'text-danger' : response.schemasDone < response.schemasTotal}">{{response.schemasTotal - response.schemasDone}}</td>
42
				</tr>
43
				<tr ng-show="response.profilesTotal != null">
44
					<th>Profiles</th>
45
					<td class="text-center col-xs-1">{{response.profilesTotal}}</td>
46
					<td class="text-center col-xs-1">{{response.profilesDone}}</td>
47
					<td class="text-center col-xs-1" ng-class="{'text-danger' : response.profilesDone < response.profilesTotal}">{{response.profilesTotal - response.profilesDone}}</td>
48
				</tr>
49
			</tbody>		
50
		</table>			
51
		
52
		
53
	</fieldset>
54
</div>
modules/dnet-modular-is-ui/tags/dnet-modular-is-ui-2.0.2/src/main/resources/eu/dnetlib/web/resources/html/is/profile.html
1
<div class="row">
2
	<div class="col-xs-12 col-md-10">
3
		<h5><b>Profile</b>  (ID: <i>{{id}}</i>)</h5>		
4
	</div>
5
	<div class="col-xs-12 col-md-2">
6
		<div class="pull-right" ng-show="profile && !editProfile">
7
			<button class="btn btn-sm btn-danger" ng-click="deleteProfile()">Delete</button>
8
			<button class="btn btn-sm btn-default" ng-click="startEditing()">Edit</button>
9
		</div>
10
		<div class="pull-right" ng-show="editProfile">
11
			<button class="btn btn-sm btn-warning" ng-click="abortEditing()">Abort</button>
12
			<button class="btn btn-sm btn-default" ng-click="saveEditing()">Save</button>
13
		</div>
14
	</div>
15
</div>
16
<pre ng-show="profile && !editProfile">{{profile}}</pre>
17
<textarea class="form-control" ng-show="editProfile" ng-model="editProfile" rows="400"></textarea>
18
<pre ng-hide="profile">The requested profile is missing</pre>
modules/dnet-modular-is-ui/tags/dnet-modular-is-ui-2.0.2/src/main/resources/eu/dnetlib/web/resources/html/is/schema.html
1
<div class="row">
2
	<div class="col-xs-9"><h4><b>Schema:</b> <i>{{name}}</i></h4></div>
3
	<div class="col-xs-3">
4
		<!-- <button class="btn btn-sm btn-default pull-right">edit</button> -->	
5
	</div>
6
</div>
7

  
8
<pre>{{schema}}</pre>
modules/dnet-modular-is-ui/tags/dnet-modular-is-ui-2.0.2/src/main/resources/eu/dnetlib/web/resources/html/is/isQuery.html
1
<form role="form">
2
	<div class="form-group">
3
		<label for="xqueryInput" class="control-label">XQuery</label>
4
		<textarea class="form-control" id="xqueryInput" ng-model="query" rows="10"></textarea>
5
	</div>
6
	<button class="btn btn-default" ng-click="searchXQuery()">Search</button>
7
	<button class="btn btn-primary pull-right" data-toggle="modal" data-target="#xqueryHistoryModal">History</button>
8
</form>
9
<br />
10

  
11
<div class="panel panel-default" ng-show="error">
12
	<div class="panel-heading">
13
		<a class="accordion-toggle" data-toggle="collapse" data-target="#collapse_error"><b>Error:</b> <i>{{error.message}}</i></a>
14
	</div>
15
	<div id="collapse_error" class="panel-collapse collapse in">
16
		<div class="panel-body">
17
			<pre>{{error.stacktrace}}</pre>
18
		</div>			
19
	</div>
20
</div>
21

  
22

  
23
<p ng-hide="error"><b>Number of results:</b> {{results.length}}<br /></p>
24

  
25
<div class="panel panel-default" ng-repeat="r in results track by $index">
26
	<div class="panel-heading">
27
		<a class="accordion-toggle" data-toggle="collapse" data-target="#collapse_{{$index}}"><b> Result: </b><i>{{$index + 1}}</i></a>
28
	</div>
29
	<div id="collapse_{{$index}}" class="panel-collapse collapse in">
30
		<div class="panel-body">
31
			<pre>{{r}}</pre>
32
		</div>
33
	</div>
34
</div>
35

  
36

  
37
<div id="xqueryHistoryModal" class="modal fade" tabindex="-1" role="dialog">
38
	<div class="modal-dialog modal-lg">
39
		<div class="modal-content">
40
			<div class="modal-header">
41
				<button type="button" class="close" data-dismiss="modal">&times;</button>
42
				<h4 class="modal-title">History</h4>
43
			</div>
44
			<div class="modal-body" style="height: 400px; overflow-y: scroll">
45
				<p class="text-center" ng-show="history.length == 0">
46
					<b>History is empty</b>
47
				</p>
48
				<div ng-repeat="e in history | reverse">
49
					<span><a href="javascript:void(0)" data-dismiss="modal" ng-click="updateXQuery(e.query)">{{e.date | date:"yyyy-MM-dd HH:mm:ss"}}</a></span>
50
					<pre>{{e.query}}</pre>
51
				</div>
52
			</div>
53
			<div class="modal-footer">
54
				<button class="btn btn-primary" data-dismiss="modal">Clear history</button>
55
				<button class="btn btn-default" data-dismiss="modal">Close</button>
56
			</div>
57
		</div>
58
	</div>
59
</div>
modules/dnet-modular-is-ui/tags/dnet-modular-is-ui-2.0.2/src/main/resources/eu/dnetlib/web/resources/html/is/profiles.html
1
<div class="well">
2
	<p>
3
		<b>path:</b> <i>{{path}}</i><br />
4
		<b>size: </b><i>{{profiles.length}}</i>
5
	</p>
6
	<fieldset>
7
		<legend>
8
			<h4>Profiles</h4>
9
		</legend>
10
		<ol>
11
			<li ng-repeat="id in profiles"><a href="#/profile/{{id}}">{{id}}</a></li>
12
		</ol>
13
	</fieldset>
14
</div>
modules/dnet-modular-is-ui/tags/dnet-modular-is-ui-2.0.2/src/main/resources/eu/dnetlib/web/resources/html/is/schemas.html
1
<div class="well">
2
	<fieldset>
3
		<legend>
4
			<h4>Registered schemas:</h4>
5
		</legend>
6
		<ol>
7
			<li ng-repeat="s in schemas"><a href="#/schema/{{s}}">{{s}}</a></li>
8
		</ol>
9
	</fieldset>
10
</div>
modules/dnet-modular-is-ui/tags/dnet-modular-is-ui-2.0.2/src/main/resources/eu/dnetlib/web/resources/html/is/blackboard.html
1
<p>
2
	<button class="btn btn-sm btn-default" ng-click="refresh()"><span class="glyphicon glyphicon-refresh"></span> refresh</button>
3
</p>
4
<table class="table table-striped small">
5
	<thead>
6
		<tr>
7
			<th>Message Id</th>
8
			<th>Resource Type</th>
9
			<th class="text-center">Action</th>
10
			<th class="text-center">Date</th>
11
			<th class="text-center">Status</th>
12
			<th class="text-center">Error</th>
13
		</tr>
14
	</thead>
15
	<tbody>
16
		<tr ng-show="blackboards.length == 0">
17
			<td colspan="6">No blackboard messsages</td>
18
		</tr>
19
		<tr ng-repeat="b in blackboards">
20
			<td><a href="#/profile/{{b.profId}}">{{b.messageId}}</a></td>
21
			<td>{{b.resourceType}}</td>
22
			<td class="text-center">{{b.action}}</td>
23
			<td class="text-center">{{b.date}}</td>
24
			<td class="text-center"><span class="label label-default" ng-class="{'label-primary': b.actionStatus=='ASSIGNED', 'label-success': b.actionStatus=='ONGOING', 'label-success': b.actionStatus=='DONE', 'label-danger': b.actionStatus=='FAILED'}">{{b.actionStatus}}</span></td>
25
			<td class="text-center"><span class="text-danger glyphicon glyphicon-warning-sign" title="{{b.error}}" ng-show="b.error"></span></td>	
26
		</tr>
27
	</tbody>
28
</table>
modules/dnet-modular-is-ui/tags/dnet-modular-is-ui-2.0.2/src/main/resources/eu/dnetlib/web/resources/html/is/register.html
1
<form role="form">
2
	<div class="form-group">
3
		<label for="newProfileInput" class="control-label">New Profile</label>
4
		<textarea class="form-control" id="newProfileInput" ng-model="profile" rows="10"></textarea>
5
	</div>
6
	<button class="btn btn-default" ng-click="register()">Register</button>
7
</form>
modules/dnet-modular-is-ui/tags/dnet-modular-is-ui-2.0.2/src/main/resources/eu/dnetlib/web/resources/html/is/verify.html
1
<div class="well">
2
	<div class="row" style="margin: 40px">
3
		<button class="btn btn-lg btn-primary col-xs-4 col-xs-offset-4" ng-click="registerValidationWfs()">
4
			<span class="glyphicon glyphicon-import pull-left"></span>Register validation workflows
5
		</button>
6
	</div>
7
	<div class="row" style="margin: 40px">
8
		<a class="btn btn-lg btn-default col-xs-4 col-xs-offset-4" ng-disabled="!metaWfId" href="workflows.do?section={{section | encodeURIComponent}}&metaWf={{metaWfId | encodeURIComponent}}"><span class="glyphicon glyphicon-log-in pull-left"></span>Go to workflow page</a>
9
	</div>
10
	<div class="row" style="margin: 40px">
11
		<a class="btn btn-lg btn-default col-xs-4 col-xs-offset-4" ng-disabled="!family" href="workflow_journal.do?family={{family}}"><span class="glyphicon glyphicon-list pull-left"></span>Show history</a>
12
	</div>
13
</div>
modules/dnet-modular-is-ui/tags/dnet-modular-is-ui-2.0.2/src/main/resources/eu/dnetlib/web/resources/html/is/backup.html
1
<div class="well">
2
	<div class="row" style="margin: 40px">
3
		<button class="btn btn-lg btn-primary col-xs-4 col-xs-offset-4" ng-click="registerBackupWfs()">
4
			<span class="glyphicon glyphicon-import pull-left"></span>Register backup workflows
5
		</button>
6
	</div>
7
	<div class="row" style="margin: 40px">
8
		<a class="btn btn-lg btn-default col-xs-4 col-xs-offset-4" ng-disabled="!metaWfId" href="workflows.do?section={{section | encodeURIComponent}}&metaWf={{metaWfId | encodeURIComponent}}">
9
			<span class="glyphicon glyphicon-log-in pull-left"></span>Go to workflow page</a>
10
	</div>
11
	<div class="row" style="margin: 40px">
12
		<a class="btn btn-lg btn-default col-xs-4 col-xs-offset-4" ng-disabled="!family" href="workflow_journal.do?family={{family}}">
13
			<span class="glyphicon glyphicon-list pull-left"></span>Show history</a>
14
	</div>
15
</div>
modules/dnet-modular-is-ui/tags/dnet-modular-is-ui-2.0.2/src/main/resources/eu/dnetlib/web/resources/html/is/subscriptions.html
1
Subscriptions
modules/dnet-modular-is-ui/tags/dnet-modular-is-ui-2.0.2/src/main/resources/eu/dnetlib/web/resources/html/is/list.html
1
<div class="well">
2
	<fieldset>
3
		<legend>
4
			<h4>List collections</h4>
5
		</legend>
6
		
7
		<ul>
8
			<li ng-repeat="r in results" ng-show="r.size > 0">{{r.kind}}
9
				<ul>
10
					<li ng-repeat="t in r.types" ng-show="t.size > 0">{{t.name}}
11
						<a href="#/profiles/{{r.kind}}/{{t.name}}">{{t.size}} profiles(s)</a>
12
					</li>
13
				</ul>		
14
			</li>
15
		</ul>
16
	</fieldset>
17
</div>
modules/dnet-modular-is-ui/tags/dnet-modular-is-ui-2.0.2/src/main/resources/eu/dnetlib/web/resources/js/is_manager.js
1
var module = angular.module('isManager', ['ngRoute', 'isManagerControllers']);
2

  
3
module.config([
4
	'$routeProvider',
5
	function($routeProvider) {
6
		$routeProvider
7
			.when('/list',                 { templateUrl: '../resources/html/is/list.html',          controller: 'listCollectionsCtrl' })
8
			.when('/profiles/:kind/:type', { templateUrl: '../resources/html/is/profiles.html',      controller: 'profilesCtrl' })
9
			.when('/profile/:id',          { templateUrl: '../resources/html/is/profile.html',       controller: 'profileCtrl' })
10
			.when('/schemas',              { templateUrl: '../resources/html/is/schemas.html',       controller: 'schemasCtrl' })
11
			.when('/schema/:name',         { templateUrl: '../resources/html/is/schema.html',        controller: 'schemaCtrl' })
12
			.when('/q',                    { templateUrl: '../resources/html/is/isQuery.html',       controller: 'isQueryCtrl' })
13
			.when('/register',             { templateUrl: '../resources/html/is/register.html',      controller: 'registerProfileCtrl' })
14
			.when('/bulk',                 { templateUrl: '../resources/html/is/bulk.html',          controller: 'bulkImporterCtrl' })
15
			.when('/verify',               { templateUrl: '../resources/html/is/verify.html',        controller: 'validateProvilesCtrl' })
16
			.when('/subscriptions',        { templateUrl: '../resources/html/is/subscriptions.html', controller: 'subscriptionsCtrl' })
17
			.when('/blackboard',           { templateUrl: '../resources/html/is/blackboard.html',    controller: 'blackboardCtrl' })
18
			.when('/backup',               { templateUrl: '../resources/html/is/backup.html',        controller: 'backupCtrl' })
19
			.otherwise({ redirectTo: '/list' });
20
	}
21
]);
22

  
23

  
24
module.controller('moduleMenuCtrl', [ '$scope', '$location',  
25
	function ($scope, $location) {
26
		$scope.isActive = function(regex) {
27
			var re = new RegExp(regex);
28
			return re.test($location.path());
29
		}
30
	}
31
]);
32

  
33
module.filter('encodeURIComponent', function() {
34
    return window.encodeURIComponent;
35
});
36

  
37
module.filter('reverse', function () {
38
	return function(items) {
39
		return items.slice().reverse();
40
	}
41
});
modules/dnet-modular-is-ui/tags/dnet-modular-is-ui-2.0.2/src/main/resources/eu/dnetlib/web/resources/js/is_manager_controllers.js
1
var isManagerControllers = angular.module('isManagerControllers', ['LocalStorageModule']);
2

  
3
function common_init($scope, $http, $sce, $location) {
4
	initSpinner();
5
	$scope.showError        = function(error)   { show_notification("error", error); }
6
	$scope.showNotification = function(message) { show_notification("info", message); }
7
	$scope.showSpinner      = function()        { showSpinner(); }
8
	$scope.hideSpinner      = function()        { hideSpinner(); }
9
	$scope.to_trusted       = function(html)    { return $sce.trustAsHtml(html); }
10
	$scope.go               = function(path)    { $location.path(path); }
11
	$scope.encodeValue      = function(val)     { return val; }
12
}
13

  
14
isManagerControllers.controller('listCollectionsCtrl', [
15
	'$scope', '$http', '$sce', '$location', '$routeParams',
16
	function ($scope, $http, $sce, $location, $routeParams) {
17
		common_init($scope, $http, $sce, $location);
18

  
19
		$scope.results = [];
20
		
21
		$scope.showSpinner();
22

  
23
		$http.get('is/listCollections.do').success(function(data) {
24
			$scope.hideSpinner();
25
			$scope.results = data;
26
		}).error(function() {
27
			$scope.showError('Error listing xmldb collections');
28
			$scope.hideSpinner();
29
	    });
30
	}
31
]);
32

  
33

  
34
isManagerControllers.controller('profilesCtrl', [
35
	'$scope', '$http', '$sce', '$location', '$routeParams',
36
	function ($scope, $http, $sce, $location, $routeParams) {
37
		common_init($scope, $http, $sce, $location);
38

  
39
		$scope.profiles = [];
40
		$scope.path = '/db/DRIVER/' + $routeParams.kind + '/' + $routeParams.type;
41
		
42
		$scope.showSpinner();
43
		
44
		$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8";
45
		$http.post('is/listProfiles.do', $.param({
46
			'kind' :  $routeParams.kind,
47
			'type' :  $routeParams.type
48
		})).success(function(data) {
49
			$scope.hideSpinner();
50
			$scope.profiles = data;
51
		}).error(function() {
52
			$scope.showError('Error listing xmldb collections');
53
			$scope.hideSpinner();
54
	    });
55
	}
56
]);
57

  
58

  
59
isManagerControllers.controller('profileCtrl', [
60
	'$scope', '$http', '$sce', '$location', '$routeParams',
61
	function ($scope, $http, $sce, $location, $routeParams) {
62
		common_init($scope, $http, $sce, $location);
63

  
64
		$scope.id = $routeParams.id;
65
		$scope.profile = '';
66
		$scope.editProfile = '';
67
		
68
		$scope.showSpinner();
69
		
70
		$http.get('is/getProfile.do?id=' + $scope.id).success(function(data) {
71
			$scope.hideSpinner();
72
			$scope.profile = data;
73
		}).error(function() {
74
			$scope.showError('Error retreiving profile');
75
			$scope.hideSpinner();
76
		});
77
		
78
		$scope.deleteProfile = function() {
79
			if (confirm("Are you sure ?")) {
80
				$scope.showSpinner();
81
				$http.get('is/deleteProfile.do?id=' + $scope.id).success(function(data) {
82
					$scope.hideSpinner();
83
					$scope.showNotification('Profile deleted !');
84
					$scope.profile = '';
85
				}).error(function() {
86
					$scope.showError('Error deleting profile');
87
					$scope.hideSpinner();
88
				});
89
			}
90
		}
91
		
92
		$scope.startEditing = function() {
93
			$scope.editProfile = '' + $scope.profile;
94
		}
95
		
96
		$scope.abortEditing = function() {
97
			$scope.editProfile = '';
98
		}
99

  
100
		$scope.saveEditing = function() {
101
			$scope.showSpinner();
102
			$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8";
103
			$http.post('is/updateProfile.do', $.param({
104
				'profile' : $scope.editProfile
105
			})).success(function(data) {
106
				$scope.hideSpinner();
107
				$scope.showNotification('Profile updated !');
108
				$scope.profile = '' + $scope.editProfile;
109
				$scope.editProfile = '';
110
			}).error(function(err) {
111
				$scope.showError(err.message);
112
				$scope.hideSpinner();
113
			});
114
		}
115
	}
116
]);
117

  
118

  
119
isManagerControllers.controller('schemasCtrl', [
120
	'$scope', '$http', '$sce', '$location', '$routeParams',
121
	function ($scope, $http, $sce, $location, $routeParams) {
122
		common_init($scope, $http, $sce, $location);
123

  
124
		$scope.schemas = [];
125
		
126
		$scope.showSpinner();
127

  
128
		$http.get('is/listSchemas.do').success(function(data) {
129
			$scope.hideSpinner();
130
			$scope.schemas = data;
131
		}).error(function() {
132
			$scope.showError('Error retreiving schemas');
133
			$scope.hideSpinner();
134
	    });
135
	}
136
]);
137

  
138

  
139
isManagerControllers.controller('schemaCtrl', [
140
	'$scope', '$http', '$sce', '$location', '$routeParams',
141
	function ($scope, $http, $sce, $location, $routeParams) {
142
		common_init($scope, $http, $sce, $location);
143

  
144
		$scope.name = $routeParams.name;
145
		$scope.schema = '';
146

  
147
		$scope.showSpinner();
148
		
149
		$http.get('is/getSchema.do?name=' + $scope.name).success(function(data) {
150
			$scope.hideSpinner();
151
			$scope.schema = data;
152
		}).error(function() {
153
			$scope.showError('Error retreiving schema' + $scope.name);
154
			$scope.hideSpinner();
155
		});
156
	}
157
]);
158

  
159
isManagerControllers.controller('isQueryCtrl', [
160
	'$scope', '$http', '$sce', '$location', '$routeParams', 'localStorageService',
161
	function ($scope, $http, $sce, $location, $routeParams, localStorageService) {
162
		common_init($scope, $http, $sce, $location);
163
		
164
		$scope.history = localStorageService.get('xquery_history');
165
		if (!$scope.history) {
166
			$scope.history = [];
167
		}
168
		
169
		$scope.query = "for $x in collection('/db/DRIVER/VocabularyDSResources/VocabularyDSResourceType') return $x";
170
		$scope.error = null;
171
		$scope.results = [];
172

  
173
        $scope.searchXQuery = function() {
174
			$scope.results = [];
175
			$scope.error = null;
176
			$scope.showSpinner();
177
			$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8";
178
			$http.post('is/xquery.do', $.param({
179
				'query' : $scope.query
180
			})).success(function(data) {
181
				$scope.hideSpinner();
182
				$scope.results = data;
183
				$scope.history.push({ 'date' : new Date(), 'query' : $scope.query });
184
				if ($scope.history.length > 100) {
185
					$scope.history = $scope.history.splice($scope.history.length - 100);
186
				}
187
				localStorageService.set('xquery_history', $scope.history);
188
			}).error(function(err) {
189
				$scope.error = err;
190
				$scope.hideSpinner();
191
			});
192
		}
193
        
194
        $scope.updateXQuery = function(q) {
195
        	$scope.query = q;
196
        	$scope.searchXQuery(); 
197
        }
198
        
199
        $scope.clearHistory = function() {
200
        	$scope.history = [];
201
        	localStorageService.set('xquery_history', []);
202
        }
203
	}
204
]);
205
isManagerControllers.controller('registerProfileCtrl', [
206
	'$scope', '$http', '$sce', '$location', '$routeParams',
207
	function ($scope, $http, $sce, $location, $routeParams) {
208
		common_init($scope, $http, $sce, $location);
209

  
210
		$scope.profile = '';
211

  
212
		$scope.register = function() {
213
			$scope.showSpinner();
214
			$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8";
215
			$http.post('is/registerProfile.do', $.param({
216
				'profile' : $scope.profile
217
			})).success(function(id) {
218
				$scope.hideSpinner();
219
				$scope.go('/profile/' + id)
220
			}).error(function() {
221
				$scope.showError('Error registerting profile');
222
				$scope.hideSpinner();
223
		    });
224
		}
225
	}
226
]);
227

  
228

  
229
isManagerControllers.controller('bulkImporterCtrl', [
230
	'$scope', '$http', '$sce', '$location', '$routeParams',
231
	function ($scope, $http, $sce, $location, $routeParams) {
232
		common_init($scope, $http, $sce, $location);
233

  
234
		$scope.path = 'file:///tmp/dnet_import';
235
		$scope.schemas = true;
236
		$scope.profiles = true;
237
		
238
		$scope.response = {};
239
		
240
		$scope.bulkImport = function() {
241
			$scope.response = {};
242
			$scope.showSpinner();
243
			$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8";
244
			$http.post('is/import.do', $.param({
245
				'path'     : $scope.path,
246
				'schemas'  : $scope.schemas,
247
				'profiles' : $scope.profiles
248
			})).success(function(data) {
249
				$scope.hideSpinner();
250
				$scope.response = data;
251
			}).error(function() {
252
				$scope.showError('Error registerting profile');
253
				$scope.hideSpinner();
254
		    });
255
		}
256
	}
257
]);
258

  
259

  
260
isManagerControllers.controller('validateProvilesCtrl', [
261
	'$scope', '$http', '$sce', '$location', '$routeParams',
262
	function ($scope, $http, $sce, $location, $routeParams) {
263
		common_init($scope, $http, $sce, $location);
264
		
265
		$scope.metaWfId = '';
266
		$scope.section = '';
267
		$scope.family = '';
268
		
269
		$scope.getValidationMetaWfId = function() {
270
			$scope.metaWfId = '';
271
			$scope.section = '';
272
			$scope.family = '';
273
			
274
			$scope.showSpinner();
275
			$http.get('is/getMetaWfIdForFamily.do?family=IS_VALIDATION').success(function(data) {
276
				$scope.hideSpinner();
277
				$scope.metaWfId = data.id;
278
				$scope.section = data.section;
279
				$scope.family = data.family;
280
			}).error(function() {
281
				$scope.showError('Metaworkflow not registered');
282
                $scope.hideSpinner();
283
			});
284
		}
285
		
286
		$scope.registerValidationWfs = function() {
287
			$scope.metaWfId = '';
288
			$scope.showSpinner();
289
			$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8";
290
			$http.post('is/import.do', $.param({
291
				'path'     : 'classpath*:/eu/dnetlib/functionality/modular/workflows/validation',
292
				'schemas'  : false,
293
				'profiles' : true
294
			})).success(function(data) {
295
				$scope.hideSpinner();
296
				$scope.showNotification('Profiles are been registered');
297
				$scope.getValidationMetaWfId();
298
			}).error(function() {
299
				$scope.showError('Error registering profiles');
300
				$scope.hideSpinner();
301
		    });
302
		}
303
		
304
		$scope.getValidationMetaWfId();
305
	}
306
]);
307

  
308
isManagerControllers.controller('subscriptionsCtrl', [
309
	'$scope', '$http', '$sce', '$location', '$routeParams',
310
	function ($scope, $http, $sce, $location, $routeParams) {
311
		common_init($scope, $http, $sce, $location);
312

  
313
		$scope.results = [];
314

  
315
		$scope.XXXXXXX = function() {
316
			$scope.results = [];
317

  
318
			$scope.showSpinner();
319
			$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8";
320
			$http.post('is/XXXXXX.do', $.param({
321
				'query' : $scope.query
322
			})).success(function(data) {
323
				$scope.hideSpinner();
324
				$scope.results = data;
325
			}).error(function() {
326
				$scope.showError('Something really bad must have happened to our fellow hamster..');
327
				$scope.hideSpinner();
328
		    });
329
		}
330
	}
331
]);
332

  
333

  
334
isManagerControllers.controller('blackboardCtrl', [
335
	'$scope', '$http', '$sce', '$location', '$routeParams',
336
	function ($scope, $http, $sce, $location, $routeParams) {
337
		common_init($scope, $http, $sce, $location);
338
		
339
		$scope.refresh = function() {
340
			$scope.blackboards = [];
341
			$scope.showSpinner();
342
			$http.get('is/listBlackboards.do').success(function(data) {
343
				$scope.hideSpinner();
344
				$scope.blackboards = data;
345
			}).error(function() {
346
				$scope.showError('Error retreiving schemas');
347
				$scope.hideSpinner();
348
		    });
349
		}
350
		$scope.refresh();
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff