Project

General

Profile

« Previous | Next » 

Revision 45373

[maven-release-plugin] copy for tag cnr-openaire-exporter-6.1.4

View differences:

modules/cnr-openaire-exporter/tags/cnr-openaire-exporter-6.1.4/deploy.info
1
{"type_source": "SVN", 
2
"goal": "package -U source:jar", 
3
"url": "http://svn-public.driver.research-infrastructures.eu/driver/dnet40/modules/cnr-openaire-exporter/trunk/", 
4
"deploy_repository": "dnet4-snapshots", 
5
"version": "4", 
6
"mail": "sandro.labruzzo@isti.cnr.it,michele.artini@isti.cnr.it, claudio.atzori@isti.cnr.it, alessia.bardi@isti.cnr.it", 
7
"deploy_repository_url": "http://maven.research-infrastructures.eu/nexus/content/repositories/dnet4-snapshots", "name": "cnr-openaire-exporter"}
modules/cnr-openaire-exporter/tags/cnr-openaire-exporter-6.1.4/src/test/java/eu/dnetlib/openaire/exporter/ProjectQueryParamsTest.java
1
package eu.dnetlib.openaire.exporter;
2

  
3
import org.junit.Before;
4
import org.junit.Test;
5

  
6
import static org.junit.Assert.assertEquals;
7

  
8
public class ProjectQueryParamsTest {
9

  
10
	private ProjectQueryParams queryParams;
11

  
12
	@Before
13
	public void setUp() throws Exception {
14
		queryParams = new ProjectQueryParams();
15

  
16
	}
17

  
18
	@Test
19
	public void testVerifyParamWhiteSpace() {
20
		queryParams.verifyParam("Discovery Projects");
21
	}
22

  
23
	@Test
24
	public void testVerifyParamPercentage() {
25
		queryParams.verifyParam("Discovery%20Projects");
26
	}
27

  
28
	@Test
29
	public void testVerifyDateParam(){
30
		String correctDate = "2012-03-04";
31
		assertEquals(correctDate, queryParams.verifyDateParam(correctDate));
32

  
33
	}
34

  
35
	@Test(expected=java.lang.IllegalArgumentException.class)
36
	public void testVerifyDateParamException(){
37
		String wrongDate = "12-12-12";
38
		queryParams.verifyDateParam(wrongDate);
39

  
40
	}
41
}
modules/cnr-openaire-exporter/tags/cnr-openaire-exporter-6.1.4/src/test/java/eu/dnetlib/openaire/exporter/ProjectsControllerTest.java
1
package eu.dnetlib.openaire.exporter;
2

  
3
import java.io.IOException;
4

  
5
import org.antlr.stringtemplate.StringTemplate;
6
import org.apache.commons.io.IOUtils;
7
import org.junit.Before;
8
import org.junit.Test;
9
import org.springframework.core.io.ClassPathResource;
10
import org.springframework.core.io.Resource;
11

  
12
import static org.junit.Assert.assertEquals;
13

  
14
public class ProjectsControllerTest {
15

  
16
	private String queryTemplate = "/eu/dnetlib/openaire/exporter/sql/projects_fundings.sql.st";
17

  
18
	private Resource expectedQueryTemplate = new ClassPathResource("/eu/dnetlib/openaire/exporter/sql/expected_projects_fundings.sql.st");
19

  
20
	private ProjectsController controller;
21
	private ProjectQueryParams params;
22

  
23
	@Before
24
	public void setup() {
25
		controller = new ProjectsController();
26
		Resource template = new ClassPathResource(queryTemplate);
27

  
28
		controller.setProjectsFundingQueryTemplate(template);
29
		params = new ProjectQueryParams();
30
	}
31

  
32
	@Test
33
	public void testObtainFP7Query() throws IllegalArgumentException, IOException {
34
		params.setFundingProgramme("FP7");
35
		params.setFundingPath(null);
36
		String res = controller.obtainQuery(params);
37
		final StringTemplate st = new StringTemplate(IOUtils.toString(expectedQueryTemplate.getInputStream()));
38
		st.setAttribute("fundingprefix", "ec__________::EC::FP7");
39
		System.out.println(res);
40
		System.out.println(st);
41
		assertEquals(st.toString(), res);
42
	}
43

  
44
	@Test
45
	public void testObtainFP7QuerySP1() throws IllegalArgumentException, IOException {
46
		params.setFundingProgramme("FP7");
47
		params.setFundingPath("SP1");
48
		String res = controller.obtainQuery(params);
49
		final StringTemplate st = new StringTemplate(IOUtils.toString(expectedQueryTemplate.getInputStream()));
50
		st.setAttribute("fundingprefix", "ec__________::EC::FP7::SP1");
51
		System.out.println(res);
52
		assertEquals(st.toString(), res);
53
	}
54

  
55
	@Test
56
	public void testObtainFP7QueryHealth() throws IllegalArgumentException, IOException {
57
		params.setFundingProgramme("FP7");
58
		params.setFundingPath("SP1::HEALTH");
59
		String res = controller.obtainQuery(params);
60
		final StringTemplate st = new StringTemplate(IOUtils.toString(expectedQueryTemplate.getInputStream()));
61
		st.setAttribute("fundingprefix", "ec__________::EC::FP7::SP1::HEALTH");
62
		System.out.println(res);
63
		assertEquals(st.toString(), res);
64
	}
65

  
66
	@Test
67
	public void testObtainFP7QueryHealth2() throws IllegalArgumentException, IOException {
68
		params.setFundingProgramme("FP7");
69
		params.setFundingPath("%::HEALTH");
70
		String res = controller.obtainQuery(params);
71
		final StringTemplate st = new StringTemplate(IOUtils.toString(expectedQueryTemplate.getInputStream()));
72
		st.setAttribute("fundingprefix", "ec__________::EC::FP7::%::HEALTH");
73
		System.out.println(res);
74
		assertEquals(st.toString(), res);
75
	}
76

  
77
	@Test
78
	public void testObtainWellcomeTrustQuery() throws IllegalArgumentException, IOException {
79
		params.setFundingProgramme("WT");
80
		params.setFundingPath(null);
81
		String res = controller.obtainQuery(params);
82
		final StringTemplate st = new StringTemplate(IOUtils.toString(expectedQueryTemplate.getInputStream()));
83
		st.setAttribute("fundingprefix", "wt__________::WT");
84
		System.out.println(res);
85
		assertEquals(st.toString(), res);
86
	}
87

  
88
	@Test
89
	public void testObtainFCTQuery() throws IllegalArgumentException, IOException {
90
		params.setFundingProgramme("FCT");
91
		params.setFundingPath(null);
92
		String res = controller.obtainQuery(params);
93
		final StringTemplate st = new StringTemplate(IOUtils.toString(expectedQueryTemplate.getInputStream()));
94
		st.setAttribute("fundingprefix", "fct_________::FCT");
95
		System.out.println(res);
96
		assertEquals(st.toString(), res);
97
	}
98

  
99
	@Test
100
	public void testQueryWithDateParams() throws IllegalArgumentException, IOException {
101
		params.setFundingProgramme("WT");
102
		params.setFundingPath(null);
103
		params.setStartFrom("2015-05-04");
104
		String res = controller.obtainQuery(params);
105
		System.out.println(res);
106
		final StringTemplate st = new StringTemplate(IOUtils.toString(expectedQueryTemplate.getInputStream()));
107
		st.setAttribute("fundingprefix", "wt__________::WT");
108
		String q = st.toString() + " AND startdate >= '2015-05-04'";
109
		assertEquals(q, res);
110
	}
111

  
112
	@Test
113
	public void testObtainSNSFQuery() throws IllegalArgumentException, IOException {
114
		params.setFundingProgramme("SNSF");
115
		params.setFundingPath(null);
116
		String res = controller.obtainQuery(params);
117
		final StringTemplate st = new StringTemplate(IOUtils.toString(expectedQueryTemplate.getInputStream()));
118
		st.setAttribute("fundingprefix", "snsf________::SNSF");
119
		System.out.println(res);
120
		assertEquals(st.toString(), res);
121
	}
122

  
123
}
modules/cnr-openaire-exporter/tags/cnr-openaire-exporter-6.1.4/src/test/resources/eu/dnetlib/openaire/exporter/FCT-project.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<ROW>
3
	<FIELD name="funder">FCT</FIELD>
4
	<FIELD name="jurisdiction">PT</FIELD>
5
	<FIELD name="end_date">2003-10-31</FIELD>
6
	<FIELD name="grant_agreement_number">32639</FIELD>
7
	<FIELD name="title">Social Classes and «lifestyles» in the city of Oporto</FIELD>
8
	<FIELD name="fundingpathid">fct_________::FCT::Orçamento de Funcionamento/POSC</FIELD>
9
	<FIELD name="acronym">PTDC/FIL-FIL/109889/2009</FIELD>
10
	<FIELD name="start_date">2000-11-01</FIELD>
11
	<FIELD name="description">description of the funding path</FIELD>
12
</ROW> 
modules/cnr-openaire-exporter/tags/cnr-openaire-exporter-6.1.4/src/test/resources/eu/dnetlib/openaire/exporter/FP7-project.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<ROW>
3
	<FIELD name="funder">EC</FIELD>
4
	<FIELD name="jurisdiction">EU</FIELD>
5
	<FIELD name="end_date">2012-07-31</FIELD>
6
	<FIELD name="grant_agreement_number">255646</FIELD>
7
	<FIELD name="title">Semiconductor lasers for generation of non-diffracting (Bessel) beams.</FIELD>
8
	<FIELD name="fundingpathid">ec__________::EC::FP7::SP3::PEOPLE</FIELD>
9
	<FIELD name="acronym">SENDBEAMS</FIELD>
10
	<FIELD name="start_date">2010-08-01</FIELD>
11
	<FIELD name="description">description of the funding path</FIELD>
12
</ROW> 
13

  
14
	
modules/cnr-openaire-exporter/tags/cnr-openaire-exporter-6.1.4/src/test/resources/eu/dnetlib/openaire/exporter/sql/expected_projects_fundings.sql.st
1
SELECT
2
	funder,
3
	jurisdiction,
4
	fundingpathid,
5
	acronym             AS "Project Acronym",
6
	title               AS "Project Title",
7
	code                AS "Grant Agreement Number",
8
	startdate           AS "Start Date",
9
	enddate             AS "End Date"
10
FROM projects_api
11
WHERE fundingpathid like '$fundingprefix$%'
modules/cnr-openaire-exporter/tags/cnr-openaire-exporter-6.1.4/src/test/resources/eu/dnetlib/openaire/exporter/SFI-project.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<ROW>
3
	<FIELD name="funder">SFI</FIELD>
4
	<FIELD name="end_date">2016-08-31</FIELD>
5
	<FIELD name="grant_agreement_number">14/ADV/RC3022</FIELD>
6
	<FIELD name="title">Dr. Vesna Jaksic</FIELD>
7
	<FIELD name="acronym" isNull="true"/>
8
	<FIELD name="fundingpathid">sfi_________::SFI::Advance Award Programme</FIELD>
9
	<FIELD name="jurisdiction" isNull="true"/>
10
	<FIELD name="start_date">2014-09-01</FIELD>
11
</ROW>
modules/cnr-openaire-exporter/tags/cnr-openaire-exporter-6.1.4/src/test/resources/eu/dnetlib/openaire/exporter/MSES-project.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<ROW>
3
	<FIELD name="funder">MSES</FIELD>
4
	<FIELD name="end_date">2009-12-31</FIELD>
5
	<FIELD name="grant_agreement_number">001-0000000-3177</FIELD>
6
	<FIELD name="title">Residence time of bacteria Escherichia coli in seawater and marine organisms</FIELD>
7
	<FIELD name="acronym" isNull="true"/>
8
	<FIELD name="fundingpathid">irb_hr______::MSES::fundingStream</FIELD>
9
	<FIELD name="jurisdiction">HR</FIELD>
10
	<FIELD name="start_date">2007-01-01</FIELD>
11
</ROW>
modules/cnr-openaire-exporter/tags/cnr-openaire-exporter-6.1.4/src/test/resources/eu/dnetlib/openaire/exporter/WT-project.xml
1
<ROW>
2
	<FIELD name="funder">WT</FIELD>
3
	<FIELD name="end_date">2013-07-29</FIELD>
4
	<FIELD name="grant_agreement_number">098241</FIELD>
5
	<FIELD name="title">EYEDIO DIGI - DEVELOPMENT OF AN INNOVATIVE, AFFORDABLE, EASY TO USE, HANDHELD RETINAL IMAGING PRODUCT FOR THE DIAGNOSIS OF DIABETIC RETINOPATHY.</FIELD>
6
	<FIELD name="acronym"></FIELD>
7
	<FIELD name="fundingpathid">wt__________::WT::Immunology and Infectious Disease</FIELD>
8
	<FIELD name="start_date">2012-01-30</FIELD>
9
	<FIELD name="jurisdiction"/>
10
	<FIELD name="description">description of the funding path</FIELD>
11
</ROW> 
modules/cnr-openaire-exporter/tags/cnr-openaire-exporter-6.1.4/src/main/java/eu/dnetlib/openaire/exporter/JdbcApiDao.java
1
package eu.dnetlib.openaire.exporter;
2

  
3
import java.io.IOException;
4
import java.io.OutputStream;
5
import java.nio.charset.Charset;
6
import java.sql.*;
7
import java.util.Arrays;
8
import java.util.List;
9
import java.util.zip.GZIPOutputStream;
10
import java.util.zip.ZipOutputStream;
11

  
12
import com.google.common.base.Function;
13
import com.google.common.base.Joiner;
14
import com.google.common.base.Splitter;
15
import com.google.common.collect.Iterables;
16
import com.google.common.collect.Lists;
17
import eu.dnetlib.miscutils.datetime.HumanTime;
18
import eu.dnetlib.openaire.exporter.model.Project;
19
import eu.dnetlib.openaire.exporter.model.ProjectDetail;
20
import org.antlr.stringtemplate.StringTemplate;
21
import org.apache.commons.dbcp2.BasicDataSource;
22
import org.apache.commons.lang.StringUtils;
23
import org.apache.commons.logging.Log;
24
import org.apache.commons.logging.LogFactory;
25
import org.springframework.beans.factory.annotation.Autowired;
26
import org.springframework.beans.factory.annotation.Value;
27

  
28
/**
29
 * Created by claudio on 20/09/16.
30
 */
31
public class JdbcApiDao {
32

  
33
	public static final Charset UTF8 = Charset.forName("UTF-8");
34
	private static final Log log = LogFactory.getLog(JdbcApiDao.class);
35
	@Value("${openaire.exporter.jdbc.maxrows}")
36
	private int maxRows;
37

  
38
	@Value("${openaire.exporter.projectdetails.flushsize}")
39
	private int gzipFlushSize;
40

  
41
	@Value("${openaire.exporter.projects2tsv.fields}")
42
	private String tsvFields;
43

  
44
	@Autowired
45
	private BasicDataSource apiDataSource;
46

  
47
	public void streamProjects(final String sql, final OutputStream out,
48
			final String head, final StringTemplate projectTemplate, final String tail,
49
			final ValueCleaner cleaner) throws IOException, SQLException {
50

  
51
		if (log.isDebugEnabled()) {
52
			log.debug("Thread " + Thread.currentThread().getId() + " begin");
53
		}
54
		final long start = System.currentTimeMillis();
55

  
56
		if (StringUtils.isNotBlank(head)) {
57
			out.write(head.getBytes(UTF8));
58
		}
59

  
60
		try(final Connection con = getConn(); final PreparedStatement stm = getStm(sql, con); final ResultSet rs = stm.executeQuery()) {
61
			while(rs.next()){
62
				final Project p = new Project()
63
						.setFunder(cleaner.clean(rs.getString("funder")))
64
						.setJurisdiction(cleaner.clean(rs.getString("jurisdiction")))
65
						.setFundingpathid(cleaner.clean(rs.getString("fundingpathid")))
66
						.setAcronym(cleaner.clean(rs.getString("Project Acronym")))
67
						.setTitle(cleaner.clean(rs.getString("Project Title")))
68
						.setCode(cleaner.clean(rs.getString("Grant Agreement Number")))
69
						.setStartdate(cleaner.clean(rs.getString("Start Date")))
70
						.setEnddate(cleaner.clean(rs.getString("End Date")));
71

  
72
				projectTemplate.reset();
73
				projectTemplate.setAttribute("p", p);
74
				out.write(projectTemplate.toString().getBytes(UTF8));
75
			}
76
			if (StringUtils.isNotBlank(tail)) {
77
				out.write(tail.getBytes(UTF8));
78
			}
79
			if (log.isDebugEnabled()) {
80
				log.debug("Thread " + Thread.currentThread().getId() + " ends, took: " + HumanTime.exactly(System.currentTimeMillis() - start));
81
			}
82
		} finally {
83
			out.close();
84
		}
85
	}
86

  
87
	public void streamProjectsTSV(final String sql, final ZipOutputStream out) throws IOException, SQLException {
88

  
89
		if (log.isDebugEnabled()) {
90
			log.debug("Thread " + Thread.currentThread().getId() + " begin");
91
		}
92
		final long start = System.currentTimeMillis();
93
		final List<String> fields = Lists.newArrayList(Splitter.on(",").omitEmptyStrings().trimResults().split(tsvFields));
94
		writeCSVLine(out, fields);
95

  
96
		try(final Connection con = getConn(); final PreparedStatement stm = getStm(sql, con); final ResultSet rs = stm.executeQuery()) {
97
			while(rs.next()) {
98
				final Project p = new Project()
99
						.setCode(rs.getString("Grant Agreement Number"))
100
						.setAcronym(rs.getString("Project Acronym"))
101
						.setTitle(rs.getString("Project Title"))
102
						.setCall_identifier(rs.getString("Call ID"))
103
						.setStartdate(rs.getString("Start Date"))
104
						.setEnddate(rs.getString("End Date"))
105
						.setEc_sc39(rs.getBoolean("ec_sc39"))
106
						.setOa_mandate_for_publications(rs.getBoolean("oa_mandate_for_publications"))
107
						.setEc_article29_3(rs.getBoolean("ec_article29_3"))
108
						.setDescription(rs.getString("Discipline"))
109
						.setLegalname(rs.getString("Organization"))
110
						.setCountryclass(rs.getString("Country"))
111
						.setRole(rs.getString("Role"))
112
						.setFirstname(rs.getString("Person Name"))
113
						.setSecondnames(rs.getString("Person Second Names"))
114
						.setEmail(rs.getString("Person Email"));
115

  
116
				writeCSVLine(out, p.asList());
117
			}
118
			out.closeEntry();
119
			if (log.isDebugEnabled()) {
120
				log.debug("Thread " + Thread.currentThread().getId() + " ends, took: " + HumanTime.exactly(System.currentTimeMillis() - start));
121
			}
122
		} finally {
123
			out.close();
124
		}
125
	}
126

  
127
	private void writeCSVLine(final ZipOutputStream out, final List<String> list) throws IOException {
128
		out.write(Joiner.on('\t').useForNull("").join(list).getBytes(UTF8));
129
		out.write('\n');
130
	}
131

  
132

  
133
	public void streamProjectDetails(final String sql, final OutputStream out, final String format) throws SQLException, IOException {
134
		if (log.isDebugEnabled()) {
135
			log.debug("Thread " + Thread.currentThread().getId() + " begin");
136
		}
137
		final long start = System.currentTimeMillis();
138
		int i = 0;
139
		try(final Connection con = getConn(); final PreparedStatement stm = getStm(sql, con); final ResultSet rs = stm.executeQuery()) {
140
			while (rs.next()) {
141
				final ProjectDetail p = getProjectDetail(rs);
142

  
143
				switch (format) {
144
				case "csv":
145
					out.write(p.asCSV().getBytes(UTF8));
146
					break;
147
				case "json":
148
					out.write(p.asJson().getBytes(UTF8));
149
					break;
150
				}
151
				if (++i % gzipFlushSize == 0) {
152
					log.debug("flushing output stream");
153
					out.flush();
154
				}
155
			}
156
			if (log.isDebugEnabled()) {
157
				log.debug("Thread " + Thread.currentThread().getId() + " ends, took: " + HumanTime.exactly(System.currentTimeMillis() - start));
158
			}
159
		} finally {
160
			if (out instanceof GZIPOutputStream) {
161
				((GZIPOutputStream) out).finish();
162
			}
163
			out.close();
164
		}
165
	}
166

  
167
	private Connection getConn() throws SQLException {
168
		final Connection conn = apiDataSource.getConnection();
169
		conn.setAutoCommit(false);
170
		return conn;
171
	}
172

  
173
	private PreparedStatement getStm(final String sql, final Connection con) throws SQLException {
174
		final PreparedStatement stm = con.prepareStatement(sql);
175
		stm.setFetchSize(maxRows);
176
		return stm;
177
	}
178

  
179
	private ProjectDetail getProjectDetail(final ResultSet rs) throws SQLException {
180
		return new ProjectDetail()
181
				.setProjectId(rs.getString("projectid"))
182
				.setAcronym(rs.getString("acronym"))
183
				.setCode(rs.getString("code"))
184
				.setOptional1(rs.getString("optional1"))
185
				.setOptional2(rs.getString("optional2"))
186
				.setJsonextrainfo(rs.getString("jsonextrainfo"))
187
				.setFundingPath(asList(rs.getArray("fundingpath")));
188
	}
189

  
190
	private List<String> asList(final Array value) throws SQLException {
191
		if (value != null) {
192
			final List<Object> list = Arrays.asList((Object[]) value.getArray());
193
			return Lists.newArrayList(Iterables.transform(list, new Function<Object, String>() {
194
				@Override
195
				public String apply(final Object o) {
196
					return o != null ? o.toString() : null;
197

  
198
				}
199
			}));
200
		}
201
		return Lists.newArrayList();
202
	}
203

  
204
}
modules/cnr-openaire-exporter/tags/cnr-openaire-exporter-6.1.4/src/main/java/eu/dnetlib/openaire/exporter/ProjectQueryParams.java
1
package eu.dnetlib.openaire.exporter;
2

  
3
import java.util.regex.Pattern;
4

  
5
import org.apache.commons.logging.Log;
6
import org.apache.commons.logging.LogFactory;
7

  
8
public class ProjectQueryParams {
9

  
10
	private String fundingProgramme = null;
11
	/** Whatever is following the fundingProgramme **/
12
	private String fundingPath = null;
13

  
14
	private String startFrom = null;
15
	private String startUntil = null;
16
	private String endFrom = null;
17
	private String endUntil = null;
18

  
19
	private static final Log log = LogFactory.getLog(ProjectQueryParams.class); // NOPMD by marko on 11/24/08 5:02 PM
20

  
21
	public String getFundingProgramme() {
22
		return fundingProgramme;
23
	}
24

  
25
	public void setFundingProgramme(final String fundingProgramme) {
26
		this.fundingProgramme = verifyParam(fundingProgramme);
27
	}
28

  
29
	public String getFundingPath() {
30
		return fundingPath;
31
	}
32

  
33
	public void setFundingPath(final String fundingPath) {
34
		this.fundingPath = verifyParam(fundingPath);
35
	}
36

  
37
	public String getStartFrom() {
38
		return startFrom;
39
	}
40

  
41
	public void setStartFrom(final String startFrom) {
42
		this.startFrom = verifyDateParam(startFrom);
43
	}
44

  
45
	public String getStartUntil() {
46
		return startUntil;
47
	}
48

  
49
	public void setStartUntil(final String startUntil) {
50
		this.startUntil = verifyDateParam(startUntil);
51
	}
52

  
53
	public String getEndFrom() {
54
		return endFrom;
55
	}
56

  
57
	public void setEndFrom(final String endFrom) {
58
		this.endFrom = verifyDateParam(endFrom);
59
	}
60

  
61
	public String getEndUntil() {
62
		return endUntil;
63
	}
64

  
65
	public void setEndUntil(final String endUntil) {
66
		this.endUntil = verifyDateParam(endUntil);
67
	}
68

  
69
	protected String verifyParam(final String p) {
70
		Pattern pattern = Pattern.compile("(\\w*(::|%| )*)*");
71
		log.debug("TESTING SQL PARAM: " + p);
72
		if ((p != null) && !pattern.matcher(p).matches()) throw new IllegalArgumentException("Parameter contains an invalid character");
73
		log.debug("TEST OK");
74
		return p;
75
	}
76

  
77
	protected String verifyDateParam(final String date){
78
		Pattern pattern = Pattern.compile("\\d\\d\\d\\d-\\d\\d-\\d\\d");
79
		log.debug("TESTING SQL DATE PARAM: " + date);
80
		if ((date != null) && !pattern.matcher(date).matches()) throw new IllegalArgumentException("Parameter date contains an invalid character. Accepted pattern is "+pattern.toString());
81
		log.debug("TEST OK");
82
		return date;
83

  
84
	}
85
}
modules/cnr-openaire-exporter/tags/cnr-openaire-exporter-6.1.4/src/main/java/eu/dnetlib/openaire/exporter/ValueCleaner.java
1
package eu.dnetlib.openaire.exporter;
2

  
3
/**
4
 * Created by claudio on 23/09/2016.
5
 */
6
public interface ValueCleaner {
7

  
8
	public String clean(String s);
9

  
10
}
modules/cnr-openaire-exporter/tags/cnr-openaire-exporter-6.1.4/src/main/java/eu/dnetlib/openaire/exporter/ProjectQueryParamsFactory.java
1
package eu.dnetlib.openaire.exporter;
2

  
3
import javax.servlet.http.HttpServletRequest;
4

  
5
public class ProjectQueryParamsFactory {
6

  
7
	private static final String BASE_PATH = "/openaire/export/";
8
	private static final String NO_FILTER = "ALL";
9

  
10
	public ProjectQueryParams generateParams(final HttpServletRequest request,
11
			final String startFrom,
12
			final String startUntil,
13
			final String endFrom,
14
			final String endUntil) {
15
		ProjectQueryParams params = new ProjectQueryParams();
16

  
17
		String[] arr = request.getPathInfo().replace(BASE_PATH, "").split("\\/");
18
		if (arr.length != 5) throw new IllegalArgumentException("Invalid url");
19

  
20
		params.setFundingProgramme(arr[0]);
21
		String stream = NO_FILTER.equals(arr[1]) ? null : arr[1];
22
		String substream = NO_FILTER.equals(arr[2]) ? null : arr[2];
23
		if (substream == null) {
24
			params.setFundingPath(stream);
25
		} else {
26
			if (stream == null) {
27
				stream = "%";
28
			}
29
			params.setFundingPath(stream + "::" + substream);
30
		}
31
		// params.setSpecificProgramme(NO_FILTER.equals(arr[1]) ? null : arr[1]);
32
		// params.setSubdivision(NO_FILTER.equals(arr[2]) ? null : arr[2]);
33
		// NB: arr[3] should be 'projects'
34
		// NB: arr[4] should be '[file].do'
35
		params.setStartFrom(startFrom);
36
		params.setStartUntil(startUntil);
37
		params.setEndFrom(endFrom);
38
		params.setEndUntil(endUntil);
39

  
40
		return params;
41
	}
42
}
modules/cnr-openaire-exporter/tags/cnr-openaire-exporter-6.1.4/src/main/java/eu/dnetlib/openaire/exporter/ProjectsController.java
1
package eu.dnetlib.openaire.exporter;
2

  
3
import java.io.BufferedOutputStream;
4
import java.io.IOException;
5
import java.io.OutputStream;
6
import java.sql.SQLException;
7
import java.text.SimpleDateFormat;
8
import java.util.Arrays;
9
import java.util.Date;
10
import java.util.Map;
11
import java.util.zip.GZIPOutputStream;
12
import java.util.zip.ZipEntry;
13
import java.util.zip.ZipOutputStream;
14
import javax.servlet.ServletOutputStream;
15
import javax.servlet.ServletResponse;
16
import javax.servlet.http.HttpServletRequest;
17
import javax.servlet.http.HttpServletResponse;
18

  
19
import com.google.common.collect.Maps;
20
import com.google.common.xml.XmlEscapers;
21
import org.antlr.stringtemplate.StringTemplate;
22
import org.apache.commons.io.IOUtils;
23
import org.apache.commons.lang.StringUtils;
24
import org.apache.commons.lang.exception.ExceptionUtils;
25
import org.apache.commons.logging.Log;
26
import org.apache.commons.logging.LogFactory;
27
import org.springframework.beans.factory.annotation.Autowired;
28
import org.springframework.beans.factory.annotation.Value;
29
import org.springframework.core.io.Resource;
30
import org.springframework.http.HttpStatus;
31
import org.springframework.stereotype.Controller;
32
import org.springframework.web.bind.annotation.*;
33

  
34
@Controller
35
public class ProjectsController {
36

  
37
	private static final Log log = LogFactory.getLog(ProjectsController.class); // NOPMD by marko on 11/24/08 5:02 PM
38

  
39
	@Value("${openaire.exporter.projectsfundings.sql.template}")
40
	private Resource projectsFundingQueryTemplate;
41

  
42
	@Value("${openaire.exporter.projects2tsv.sql.template}")
43
	private Resource projects2tsvQueryTemplate;
44

  
45
	@Value("${openaire.exporter.dspace.template.project}")
46
	private Resource dspaceTemplate;
47

  
48
	@Value("${openaire.exporter.dspace.template.head}")
49
	private Resource dspaceHeadTemplate;
50

  
51
	@Value("${openaire.exporter.dspace.template.tail}")
52
	private Resource dspaceTailTemplate;
53

  
54
	@Value("${openaire.exporter.eprints.template}")
55
	private Resource eprintsTemplate;
56

  
57
	@Value("${openaire.exporter.projectdetails.sql}")
58
	private Resource projectDetailsSql;
59

  
60
	@Autowired
61
	private JdbcApiDao dao;
62

  
63
	@Autowired
64
	private ProjectQueryParamsFactory projectQueryParamsFactory;
65

  
66
	public enum Funding {
67
		FP7, WT, FCT, H2020, NHMRC, ARC, SFI, MZOS, HRZZ, NWO, MESTD, FWF, SNSF, RCUK
68
	}
69

  
70
	@RequestMapping(value = "/openaire/export/**/project/dspace.do")
71
	void processDspace(final HttpServletRequest request,
72
			final ServletResponse response,
73
			@RequestParam(value = "startFrom", required = false) final String startFrom,
74
			@RequestParam(value = "startUntil", required = false) final String startUntil,
75
			@RequestParam(value = "endFrom", required = false) final String endFrom,
76
			@RequestParam(value = "endUntil", required = false) final String endUntil) throws Exception {
77

  
78

  
79
		final ProjectQueryParams params = projectQueryParamsFactory.generateParams(request, startFrom, startUntil, endFrom, endUntil);
80

  
81
		final StringTemplate headSt = new StringTemplate(IOUtils.toString(dspaceHeadTemplate.getInputStream()));
82
		headSt.setAttribute("fundingProgramme", params.getFundingProgramme());
83

  
84
		final StringTemplate tailSt = new StringTemplate(IOUtils.toString(dspaceTailTemplate.getInputStream()));
85

  
86
		response.setContentType("text/xml");
87
		doProcess(response, params, headSt.toString(), dspaceTemplate, tailSt.toString(), new ValueCleaner() {
88
			@Override
89
			public String clean(final String s) {
90
				return XmlEscapers.xmlContentEscaper().escape(oneLiner(s));
91
			}
92
		});
93
	}
94

  
95
	@RequestMapping(value = "/openaire/export/**/project/eprints.do")
96
	void processEprints(final HttpServletRequest request,
97
			final ServletResponse response,
98
			@RequestParam(value = "startFrom", required = false) final String startFrom,
99
			@RequestParam(value = "startUntil", required = false) final String startUntil,
100
			@RequestParam(value = "endFrom", required = false) final String endFrom,
101
			@RequestParam(value = "endUntil", required = false) final String endUntil) throws Exception {
102

  
103
		final ProjectQueryParams params = projectQueryParamsFactory.generateParams(request, startFrom, startUntil, endFrom, endUntil);
104
		response.setContentType("text/html");
105
		doProcess(response, params, null, eprintsTemplate, null, new ValueCleaner() {
106
			@Override
107
			public String clean(final String s) {
108
				return oneLiner(s);
109
			}
110
		});
111
	}
112

  
113
	private String oneLiner(final String s) {
114
		return StringUtils.isNotBlank(s) ? s.replaceAll("\\n", " ").trim() : "";
115
	}
116

  
117
	private void doProcess(
118
			final ServletResponse response,
119
			final ProjectQueryParams params,
120
			final String head, final Resource projectTemplate, final String tail,
121
			final ValueCleaner cleaner) throws IOException, SQLException {
122

  
123
		final StringTemplate st = new StringTemplate(IOUtils.toString(projectTemplate.getInputStream()));
124
		dao.streamProjects(obtainQuery(params), response.getOutputStream(), head, st, tail, cleaner);
125
	}
126

  
127
	@RequestMapping(value = "/openaire/export/project2tsv.do")
128
	void processTsv(final HttpServletRequest request, final HttpServletResponse response,
129
			@RequestParam(value = "funding", required = true) final String funding,
130
			@RequestParam(value = "article293", required = false) final Boolean article293) throws Exception {
131

  
132
		final String date = new SimpleDateFormat("yyyyMMdd").format(new Date());
133
		final String filename = "projects_" + funding + "_" + date + ".tsv";
134
		response.setContentType("text/tab-separated-values");
135
		response.setHeader("Content-Disposition", "attachment; filename=\"" + filename + ".zip\"");
136

  
137
		final StringTemplate st = new StringTemplate(IOUtils.toString(projects2tsvQueryTemplate.getInputStream()));
138
		Funding requestedFunding = Funding.valueOf(funding.toUpperCase());
139
		String fundingPrefix = getFundingPrefix(requestedFunding, null);
140
		log.debug("Setting fundingprefix to " + fundingPrefix);
141
		st.setAttribute("fundingprefix", fundingPrefix);
142
		st.setAttribute("filters", expandFilters(article293));
143

  
144
		final ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream(response.getOutputStream()));
145
		out.putNextEntry(new ZipEntry(filename));
146
		dao.streamProjectsTSV(st.toString(), out);
147
	}
148

  
149
	@RequestMapping(value = "/openaire/export/streamProjectDetails.do")
150
	void streamProjectDetails(final HttpServletResponse response,
151
			@RequestParam(value = "format", required = true) final String format,
152
			@RequestParam(value = "compress", required = false) final Boolean compress) throws IOException, SQLException {
153
		final String sql = IOUtils.toString(projectDetailsSql.getInputStream());
154

  
155
		if (compress != null && compress) {
156
			response.setHeader("Content-Encoding", "gzip");
157
		}
158
		switch (format) {
159
		case "csv":
160
			response.setContentType("text/csv");
161
			break;
162
		case "json":
163
			response.setContentType("text/plain");
164
			break;
165
		default: throw new IllegalArgumentException("unsupported format: " + format);
166
		}
167

  
168
		final OutputStream outputStream = getOutputStream(response.getOutputStream(), compress);
169
		dao.streamProjectDetails(sql, outputStream, format);
170
	}
171

  
172
	private OutputStream getOutputStream(final ServletOutputStream outputStream, final Boolean compress) throws IOException {
173
		if (compress != null && compress) {
174
			return new GZIPOutputStream(outputStream);
175
		}
176
		return outputStream;
177
	}
178

  
179
	@ExceptionHandler({Exception.class, Throwable.class})
180
	@ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR)
181
	public @ResponseBody ErrorMessage handleSqlException(final Exception e) {
182
		log.error(e.getMessage());
183
		return new ErrorMessage(e);
184
	}
185

  
186
	public class ErrorMessage {
187

  
188
		private final String message;
189
		private final String stacktrace;
190

  
191
		public ErrorMessage(final Exception e) {
192
			this(e.getMessage(), ExceptionUtils.getStackTrace(e));
193
		}
194

  
195
		public ErrorMessage(final String message, final String stacktrace) {
196
			this.message = message;
197
			this.stacktrace = stacktrace;
198
		}
199

  
200
		public String getMessage() {
201
			return this.message;
202
		}
203

  
204
		public String getStacktrace() {
205
			return this.stacktrace;
206
		}
207
	}
208

  
209

  
210
	private Map<String, String> expandFilters(final Boolean article293) {
211
		final Map<String, String> res = Maps.newHashMap();
212

  
213
		if (article293 != null) {
214
			res.put("ec_article29_3", String.valueOf(article293));
215
		}
216

  
217
		return res;
218
	}
219

  
220
	/**
221
	 * Creates the query on the fundingProgramme specified in the given parameters.
222
	 *
223
	 * @param params
224
	 *            request parameters
225
	 * @return the query string
226
	 * @throws IllegalArgumentException
227
	 *             if the funding program is not recognized
228
	 * @throws IOException
229
	 *             if there are problem loading the query temlate
230
	 * @throws IllegalArgumentException
231
	 *             if the funding program is not recognized
232
	 */
233
	protected String obtainQuery(final ProjectQueryParams params) throws IllegalArgumentException, IOException {
234
		String funding = params.getFundingProgramme();
235
		String suffix = params.getFundingPath();
236
		String fundingPrefix = getFundingPrefix(Funding.valueOf(funding.toUpperCase()), suffix);
237
		final StringTemplate st = new StringTemplate(IOUtils.toString(projectsFundingQueryTemplate.getInputStream()));
238
		st.setAttribute("fundingprefix", fundingPrefix);
239
		String theQuery = setDateParameters(st.toString(), params);
240
		log.debug("Generated query: " + theQuery);
241
		return theQuery;
242
	}
243

  
244
	private String getFundingPrefix(final Funding funding, final String suffix) throws IllegalArgumentException {
245
		switch (funding) {
246
		case FCT:
247
			if (StringUtils.isBlank(suffix)) return "fct_________::FCT";
248
			else return "fct_________::FCT::" + suffix;
249
		case WT:
250
			if (StringUtils.isBlank(suffix)) return "wt__________::WT";
251
			else return "wt__________::WT::" + suffix;
252
		case FP7:
253
			if (StringUtils.isBlank(suffix)) return "ec__________::EC::FP7";
254
			else return "ec__________::EC::FP7::" + suffix;
255
		case H2020:
256
			if (StringUtils.isBlank(suffix)) return "ec__________::EC::H2020";
257
			else return "ec__________::EC::H2020" + suffix;
258
		case NHMRC:
259
			if (StringUtils.isBlank(suffix)) return "nhmrc_______::NHMRC";
260
			else return "nhmrc_______::NHMRC::" + suffix;
261
		case ARC:
262
			if (StringUtils.isBlank(suffix)) return "arc_________::ARC";
263
			else return "arc_________::ARC::" + suffix;
264
		case SFI:
265
			if (StringUtils.isBlank(suffix)) return "sfi_________::SFI";
266
			else return "sfi_________::SFI::" + suffix;
267
		case MZOS:
268
			if (StringUtils.isBlank(suffix)) return "irb_hr______::MZOS";
269
			else return "irb_hr______::MZOS::" + suffix;
270
		case HRZZ:
271
			if (StringUtils.isBlank(suffix)) return "irb_hr______::HRZZ";
272
			else return "irb_hr______::HRZZ::" + suffix;
273
		case NWO:
274
			if (StringUtils.isBlank(suffix)) return "nwo_________::NWO";
275
			else return "nwo_________::NWO::" + suffix;
276
		case MESTD:
277
			if (StringUtils.isBlank(suffix)) return "mestd_______::MESTD";
278
			else return "mestd_______::MESTD::" + suffix;
279
		case FWF:
280
			if (StringUtils.isBlank(suffix)) return "fwf_________::FWF";
281
			else return "fwf_________::FWF::" + suffix;
282
		case SNSF:
283
			if (StringUtils.isBlank(suffix)) return "snsf________::SNSF";
284
			else return "snsf________::SNSF::" + suffix;
285
		case RCUK:
286
			if (StringUtils.isBlank(suffix)) return "rcuk________::RCUK";
287
			else return "rcuk________::RCUK::" + suffix;
288
		default:
289
			throw new IllegalArgumentException("Invalid funding " + funding + " (valid are: " + Arrays.asList(Funding.values()) + ") ");
290
		}
291
	}
292

  
293
	private String setDateParameters(final String query, final ProjectQueryParams params) {
294
		String queryWithDates = query;
295
		if (params.getStartFrom() != null) {
296
			queryWithDates += " AND startdate >= '" + params.getStartFrom() + "'";
297
		}
298
		if (params.getStartUntil() != null) {
299
			queryWithDates += " AND startdate <= '" + params.getStartUntil() + "'";
300
		}
301
		if (params.getEndFrom() != null) {
302
			queryWithDates += " AND enddate >= '" + params.getEndFrom() + "'";
303
		}
304
		if (params.getEndUntil() != null) {
305
			queryWithDates += " AND enddate <= '" + params.getEndUntil() + "'";
306
		}
307
		return queryWithDates;
308
	}
309

  
310
	public void setProjectsFundingQueryTemplate(final Resource projectsFundingQueryTemplate) {
311
		this.projectsFundingQueryTemplate = projectsFundingQueryTemplate;
312
	}
313

  
314
}
modules/cnr-openaire-exporter/tags/cnr-openaire-exporter-6.1.4/src/main/resources/eu/dnetlib/openaire/exporter/sql/projects_tsv.sql.st
1
SELECT
2
	code                                                           AS "Grant Agreement Number",
3
	acronym                                                        AS "Project Acronym",
4
	title                                                          AS "Project Title",
5
	call_identifier                                                AS "Call ID",
6
	startdate                                                      AS "Start Date",
7
	enddate                                                        AS "End Date",
8
	ec_sc39                                                        AS "ec_sc39",
9
	oa_mandate_for_publications                                    AS "oa_mandate_for_publications",
10
	ec_article29_3                                                 AS "ec_article29_3",
11
	description                                                    AS "Discipline",
12
	legalname                                                      AS "Organization",
13
	countryclass                                                   AS "Country",
14
	role                                                           AS "Role",
15
	firstname                                                      AS "Person Name",
16
	secondnames                                                    AS "Person Second Names",
17
	email                                                          AS "Person Email"
18
FROM projects_tsv
19
WHERE fundingpathid like '$fundingprefix$%'$filters.keys:{k| AND $k$=$filters.(k)$}$
20
ORDER BY acronym
modules/cnr-openaire-exporter/tags/cnr-openaire-exporter-6.1.4/src/main/resources/eu/dnetlib/openaire/exporter/sql/projects_fundings.sql.st
1
SELECT
2
	funder,
3
	jurisdiction,
4
	fundingpathid,
5
	acronym             AS "Project Acronym",
6
	title               AS "Project Title",
7
	code                AS "Grant Agreement Number",
8
	startdate           AS "Start Date",
9
	enddate             AS "End Date"
10
FROM projects_api
11
WHERE fundingpathid like '$fundingprefix$%'
modules/cnr-openaire-exporter/tags/cnr-openaire-exporter-6.1.4/src/main/resources/eu/dnetlib/openaire/exporter/sql/projects_details.sql
1
SELECT * FROM project_details;
modules/cnr-openaire-exporter/tags/cnr-openaire-exporter-6.1.4/src/main/resources/eu/dnetlib/openaire/exporter/st/projects_eprints.st
1
$p.acronym$ - $p.title$&#9;<li style='border-right: solid 50px #30FF30' >$p.code$ - $p.acronym$ - $p.title$<ul><li id="$p.listLabel$">$p.idnamespace$</li></ul></li>
modules/cnr-openaire-exporter/tags/cnr-openaire-exporter-6.1.4/src/main/resources/eu/dnetlib/openaire/exporter/st/projects_dspace_project.st
1
<pair>
2
	<displayed-value>$p.code$ - $p.acronym$ - $p.title$</displayed-value>
3
	<stored-value>$p.idnamespace$</stored-value>
4
</pair>
modules/cnr-openaire-exporter/tags/cnr-openaire-exporter-6.1.4/src/main/resources/eu/dnetlib/openaire/exporter/st/projects_dspace_header.st
1
<?xml version='1.0' encoding='UTF-8'?>
2

  
3
<form-value-pairs>
4
	<value-pairs value-pairs-name='$fundingProgramme$projects' dc-term='relation'>
modules/cnr-openaire-exporter/tags/cnr-openaire-exporter-6.1.4/src/main/resources/eu/dnetlib/openaire/exporter/st/projects_dspace_tail.st
1
 </value-pairs>
2
</form-value-pairs>
modules/cnr-openaire-exporter/tags/cnr-openaire-exporter-6.1.4/src/main/resources/eu/dnetlib/openaire/exporter/webContext-openaire-exporter.xml
1
<beans xmlns="http://www.springframework.org/schema/beans"
2
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
3
       xmlns:context="http://www.springframework.org/schema/context"
4
       xmlns:util="http://www.springframework.org/schema/util"
5
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
6
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
7
        http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
8

  
9
	<bean id="projectQueryParamsFactory" class="eu.dnetlib.openaire.exporter.ProjectQueryParamsFactory"/>
10

  
11
	<bean id="jdbcApiDao" class="eu.dnetlib.openaire.exporter.JdbcApiDao" />
12

  
13
	<bean id="apiDataSource" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close"
14
	      p:driverClassName="org.postgresql.Driver"
15
	      p:url="${openaire.exporter.jdbc.url}"
16
	      p:username="${openaire.exporter.jdbc.user}"
17
	      p:password="${openaire.exporter.jdbc.pwd}"
18
	      p:minIdle="${openaire.exporter.jdbc.minIdle}"
19
	      p:maxIdle="${openaire.exporter.jdbc.maxIdle}"/>
20

  
21
</beans>
modules/cnr-openaire-exporter/tags/cnr-openaire-exporter-6.1.4/src/main/resources/eu/dnetlib/openaire/exporter/applicationContext-openaire-exporter.properties
1
openaire.exporter.dspace.template.head=classpath:/eu/dnetlib/openaire/exporter/st/projects_dspace_header.st
2
openaire.exporter.dspace.template.project=classpath:/eu/dnetlib/openaire/exporter/st/projects_dspace_project.st
3
openaire.exporter.dspace.template.tail=classpath:/eu/dnetlib/openaire/exporter/st/projects_dspace_tail.st
4
openaire.exporter.eprints.template=classpath:/eu/dnetlib/openaire/exporter/st/projects_eprints.st
5
openaire.exporter.projects2tsv.sql.template=classpath:/eu/dnetlib/openaire/exporter/sql/projects_tsv.sql.st
6
openaire.exporter.projects2tsv.fields = Grant Agreement Number, Project Acronym, Project Title, Call ID, Start Date, End Date, ec_sc39, oa_mandate_for_publications, ec_article29_3, Discipline, Organization, Country, Role, Person Name, Person Second Names, Person Email
7
openaire.exporter.projectsfundings.sql.template=classpath:/eu/dnetlib/openaire/exporter/sql/projects_fundings.sql.st
8
openaire.exporter.projectdetails.sql=classpath:/eu/dnetlib/openaire/exporter/sql/projects_details.sql
9
openaire.exporter.jdbc.url=jdbc:postgresql://localhost:5432/dnet_openaireplus
10
openaire.exporter.jdbc.user=dnetapi
11
openaire.exporter.jdbc.pwd=dnetPwd
12
openaire.exporter.jdbc.minIdle=1
13
openaire.exporter.jdbc.maxIdle=20
14
openaire.exporter.jdbc.maxrows=100
15
openaire.exporter.projectdetails.flushsize=1000
modules/cnr-openaire-exporter/tags/cnr-openaire-exporter-6.1.4/pom.xml
1
<?xml version="1.0" ?>
2
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3
	<parent>
4
		<groupId>eu.dnetlib</groupId>
5
		<artifactId>dnet-parent</artifactId>
6
		<version>1.0.0</version>
7
		<relativePath />
8
	</parent>
9
	<modelVersion>4.0.0</modelVersion>
10
	<groupId>eu.dnetlib</groupId>
11
	<artifactId>cnr-openaire-exporter</artifactId>
12
	<packaging>jar</packaging>
13
	<version>6.1.4</version>
14
	<scm>
15
	  <developerConnection>scm:svn:https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/cnr-openaire-exporter/tags/cnr-openaire-exporter-6.1.4</developerConnection>
16
	</scm>
17
	<dependencies>
18
		<dependency>
19
			<groupId>eu.dnetlib</groupId>
20
			<artifactId>cnr-service-common</artifactId>
21
			<version>[2.1.2,3.0.0)</version>
22
		</dependency>
23
		<dependency>
24
			<groupId>eu.dnetlib</groupId>
25
			<artifactId>dnet-openaireplus-mapping-utils</artifactId>
26
			<version>[5.0.0,6.0.0)</version>
27
			<exclusions>
28
				<exclusion>
29
					<groupId>com.sun.jersey</groupId>
30
					<artifactId>jersey-server</artifactId>
31
				</exclusion>
32
			</exclusions>
33
		</dependency>
34
		<dependency>
35
			<groupId>org.postgresql</groupId>
36
			<artifactId>jdbc4driver</artifactId>
37
			<version>9.3-1104</version>
38
		</dependency>
39
		<dependency>
40
			<groupId>org.apache.commons</groupId>
41
			<artifactId>commons-dbcp2</artifactId>
42
			<version>2.1</version>
43
		</dependency>
44
		<dependency>
45
			<groupId>com.google.code.gson</groupId>
46
			<artifactId>gson</artifactId>
47
			<version>${google.gson.version}</version>
48
		</dependency>
49

  
50
		<dependency>
51
			<groupId>javax.servlet</groupId>
52
			<artifactId>javax.servlet-api</artifactId>
53
			<version>${javax.servlet.version}</version>
54
			<scope>provided</scope>
55
		</dependency>
56
		<dependency>
57
			<groupId>junit</groupId>
58
			<artifactId>junit</artifactId>
59
			<version>${junit.version}</version>
60
			<scope>test</scope>
61
		</dependency>
62
	</dependencies>
63
</project>

Also available in: Unified diff