Index: modules/dnet-directindex-api/trunk/src/test/java/eu/dnetlib/msro/openaireplus/api/objects/ResultEntryTest.java
===================================================================
--- modules/dnet-directindex-api/trunk/src/test/java/eu/dnetlib/msro/openaireplus/api/objects/ResultEntryTest.java	(revision 51235)
+++ modules/dnet-directindex-api/trunk/src/test/java/eu/dnetlib/msro/openaireplus/api/objects/ResultEntryTest.java	(revision 51236)
@@ -1,5 +1,8 @@
 package eu.dnetlib.msro.openaireplus.api.objects;
 
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.when;
+
 import java.io.InputStreamReader;
 import java.io.StringReader;
 import java.util.ArrayList;
@@ -6,9 +9,6 @@
 import java.util.Arrays;
 import java.util.Properties;
 
-import com.google.gson.Gson;
-import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService;
-import eu.dnetlib.msro.rmi.MSROException;
 import org.apache.commons.lang3.StringEscapeUtils;
 import org.apache.velocity.app.VelocityEngine;
 import org.dom4j.Document;
@@ -19,13 +19,13 @@
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
-import org.mockito.invocation.InvocationOnMock;
 import org.mockito.runners.MockitoJUnitRunner;
-import org.mockito.stubbing.Answer;
 
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Mockito.when;
+import com.google.gson.Gson;
 
+import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService;
+import eu.dnetlib.msro.openaireplus.api.DirecIndexApiException;
+
 /**
  * Created by michele on 14/12/15.
  */
@@ -47,42 +47,32 @@
 		ve = new VelocityEngine();
 		ve.init(props);
 
-		when(lookUpService.quickSearchProfile(anyString())).thenAnswer(new Answer<Object>() {
-
-			@Override
-			public Object answer(final InvocationOnMock invocation) throws Throwable {
-				final String query = invocation.getArguments()[0].toString();
-				if (query.contains("dnet:result_typologies")) {
-					return Arrays.asList("publication @@@ publication", "dataset @@@ dataset");
-				} else if (query.contains("dnet:access_modes")) {
-					return Arrays.asList("OPEN @@@ Open Access");
-				} else if (query.contains("dnet:publication_resource")) {
-					return Arrays.asList("0001 @@@ Journal Article");
-				} else if (query.contains("dnet:pid_types")) {
-					return Arrays.asList("oai @@@ Open Archive Initiative", "doi @@@ Digital object identifier");
-				} else if (query.contains("dnet:languages")) {
-					return Arrays.asList("ita @@@ Italian");
-				} else if (query.contains("ContextDSResourceType")) {
-					return Arrays.asList(
-							"egi::classification::natsc::math::stats @@@ Statistics and Probability",
-							"egi::classification::natsc::math::pure @@@ Pure Mathematics",
-							"egi::classification::natsc::math @@@ Mathematics",
-							"egi::classification::natsc @@@ Natural Sciences",
-							"egi::classification @@@ EGI classification scheme",
-							"egi @@@ EGI");
-				} else {
-					return new ArrayList<String>();
-				}
+		when(lookUpService.quickSearchProfile(anyString())).thenAnswer(invocation -> {
+			final String query = invocation.getArguments()[0].toString();
+			if (query.contains("dnet:result_typologies")) {
+				return Arrays.asList("publication @@@ publication", "dataset @@@ dataset");
+			} else if (query.contains("dnet:access_modes")) {
+				return Arrays.asList("OPEN @@@ Open Access");
+			} else if (query.contains("dnet:publication_resource")) {
+				return Arrays.asList("0001 @@@ Journal Article");
+			} else if (query.contains("dnet:pid_types")) {
+				return Arrays.asList("oai @@@ Open Archive Initiative", "doi @@@ Digital object identifier");
+			} else if (query.contains("dnet:languages")) {
+				return Arrays.asList("ita @@@ Italian");
+			} else if (query.contains("ContextDSResourceType")) {
+				return Arrays.asList(
+						"egi::classification::natsc::math::stats @@@ Statistics and Probability",
+						"egi::classification::natsc::math::pure @@@ Pure Mathematics",
+						"egi::classification::natsc::math @@@ Mathematics",
+						"egi::classification::natsc @@@ Natural Sciences",
+						"egi::classification @@@ EGI classification scheme",
+						"egi @@@ EGI");
+			} else {
+				return new ArrayList<String>();
 			}
 		});
 
-		when(lookUpService.getResourceProfileByQuery(anyString())).thenAnswer(new Answer<Object>() {
-
-			@Override
-			public Object answer(final InvocationOnMock invocation) throws Throwable {
-				return "REPO NAME @@@ repo________";
-			}
-		});
+		when(lookUpService.getResourceProfileByQuery(anyString())).thenAnswer(invocation -> "REPO NAME @@@ repo________");
 	}
 
 	@Test
@@ -109,7 +99,7 @@
 		pub.getContexts().add("egi::classification::natsc::math::stats");
 		final String xml = pub.asOafRecord(ve, lookUpService, "http://oaf/oaf.xsd");
 
-		final Document doc = (new SAXReader()).read(new StringReader(xml));
+		final Document doc = new SAXReader().read(new StringReader(xml));
 
 		final OutputFormat format = OutputFormat.createPrettyPrint();
 
@@ -141,7 +131,7 @@
 
 	}
 
-	@Test(expected = MSROException.class)
+	@Test(expected = DirecIndexApiException.class)
 	public void testAsIndexRecord_wrongOpenaireId() throws Exception {
 
 		testAsIndexRecord_json("test_record_wrong_openaireId.json");
@@ -157,12 +147,12 @@
 
 	private void testAsIndexRecord_json(final String filename) throws Exception {
 		final ResultEntry pub =
-				(new Gson()).fromJson(new InputStreamReader(getClass().getResourceAsStream(filename)), ResultEntry.class);
+				new Gson().fromJson(new InputStreamReader(getClass().getResourceAsStream(filename)), ResultEntry.class);
 
 		final String xml = pub.asOafRecord(ve, lookUpService, "http://oaf/oaf.xsd");
 		System.out.println(xml);
 
-		final Document doc = (new SAXReader()).read(new StringReader(xml));
+		final Document doc = new SAXReader().read(new StringReader(xml));
 
 		final OutputFormat format = OutputFormat.createPrettyPrint();
 
@@ -174,10 +164,10 @@
 	}
 
 	@Test
-	public void testEscapeUnicode(){
-		String unicodeTxt = "i.e. closed curves of the form $t\ud835\udfc4 [0,2\u03c0] \u21a6 (\\cos t)u + (\\sin t)v$ for suitable orthogonal vectors $u$";
+	public void testEscapeUnicode() {
+		final String unicodeTxt =
+				"i.e. closed curves of the form $t\ud835\udfc4 [0,2\u03c0] \u21a6 (\\cos t)u + (\\sin t)v$ for suitable orthogonal vectors $u$";
 		System.out.println(StringEscapeUtils.escapeXml11(unicodeTxt));
 	}
 
-
 }
Index: modules/dnet-directindex-api/trunk/src/main/java/eu/dnetlib/msro/openaireplus/api/OpenaireResultSubmitter.java
===================================================================
--- modules/dnet-directindex-api/trunk/src/main/java/eu/dnetlib/msro/openaireplus/api/OpenaireResultSubmitter.java	(revision 51235)
+++ modules/dnet-directindex-api/trunk/src/main/java/eu/dnetlib/msro/openaireplus/api/OpenaireResultSubmitter.java	(revision 51236)
@@ -2,19 +2,9 @@
 
 import java.io.IOException;
 import java.util.List;
+
 import javax.annotation.Resource;
 
-import com.google.common.collect.Lists;
-import com.google.gson.Gson;
-import eu.dnetlib.common.rmi.DNetRestDocumentation;
-import eu.dnetlib.data.index.CloudIndexClient;
-import eu.dnetlib.data.index.CloudIndexClientFactory;
-import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException;
-import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService;
-import eu.dnetlib.enabling.locators.UniqueServiceLocator;
-import eu.dnetlib.msro.openaireplus.api.objects.ResultEntry;
-import eu.dnetlib.msro.openaireplus.utils.OafToIndexRecordFactory;
-import eu.dnetlib.msro.rmi.MSROException;
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang.exception.ExceptionUtils;
 import org.apache.commons.logging.Log;
@@ -24,8 +14,27 @@
 import org.springframework.core.io.ClassPathResource;
 import org.springframework.http.HttpStatus;
 import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.ResponseStatus;
 
+import com.google.common.collect.Lists;
+import com.google.gson.Gson;
+
+import eu.dnetlib.common.rmi.DNetRestDocumentation;
+import eu.dnetlib.data.index.CloudIndexClient;
+import eu.dnetlib.data.index.CloudIndexClientFactory;
+import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException;
+import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService;
+import eu.dnetlib.enabling.locators.UniqueServiceLocator;
+import eu.dnetlib.msro.openaireplus.api.objects.ResultEntry;
+import eu.dnetlib.msro.openaireplus.api.utils.OafToIndexRecordFactory;
+
 /**
  * Created by michele on 11/11/15.
  */
@@ -90,51 +99,46 @@
 
 	@Deprecated
 	@RequestMapping(value = { "/api/publications/feedJson", "/api/results/feedJson" }, method = RequestMethod.POST)
-	public
-	@ResponseBody
-	String feedObjectJson(@RequestParam(value = "json", required = true) final String json,
-			@RequestParam(value = "commit", required = false, defaultValue = "true") final boolean commit) throws MSROException {
+	public @ResponseBody String feedObjectJson(@RequestParam(value = "json", required = true) final String json,
+			@RequestParam(value = "commit", required = false, defaultValue = "true") final boolean commit) throws DirecIndexApiException {
 		final ResultEntry pub = new Gson().fromJson(json, ResultEntry.class);
 		return feedObject(pub, commit);
 	}
 
 	@RequestMapping(value = { "/api/results/feedObject" }, method = RequestMethod.POST)
-	public
-	@ResponseBody
-	String feedResult(@RequestBody final ResultEntry pub,
+	public @ResponseBody String feedResult(@RequestBody final ResultEntry pub,
 			@RequestParam(value = "commit", required = false, defaultValue = "true") final boolean commit)
-			throws MSROException {
+			throws DirecIndexApiException {
 
 		try {
 			return feedObject(pub, commit);
 		} catch (final Throwable e) {
-			throw new MSROException("Error adding publication: " + e.getMessage(), e);
+			throw new DirecIndexApiException("Error adding publication: " + e.getMessage(), e);
 		}
 	}
 
 	@RequestMapping(value = { "/api/publications/feedObject" }, method = RequestMethod.POST)
-	public
-	@ResponseBody
-	String feedObject(@RequestBody final ResultEntry pub,
+	public @ResponseBody String feedObject(@RequestBody final ResultEntry pub,
 			@RequestParam(value = "commit", required = false, defaultValue = "true") final boolean commit)
-			throws MSROException {
+			throws DirecIndexApiException {
 
 		final List<IndexDsInfo> idxList;
 		try {
 			idxList = calculateCurrentIndexDsInfo();
-			if (idxList == null || idxList.isEmpty()) {
-				throw new MSROException("Cannot add result: " + pub.getAnyId() + " : No public Search Service found");
+			if (idxList == null
+					|| idxList.isEmpty()) { throw new DirecIndexApiException("Cannot add result: " + pub.getAnyId() + " : No public Search Service found"); }
+			if (idxList.size() > 1) {
+				log.warn("Found more than 1 public search service");
 			}
-			if (idxList.size() > 1) log.warn("Found more than 1 public search service");
 			final String oafRecord = pub.asOafRecord(velocityEngine, serviceLocator.getService(ISLookUpService.class), oafSchemaLocation);
 
-			for (IndexDsInfo idx : idxList) {
+			for (final IndexDsInfo idx : idxList) {
 				CloudIndexClient idxClient = null;
 				try {
 					idxClient = CloudIndexClientFactory.newIndexClient(idx.getIndexBaseUrl(), idx.getColl(), false);
 					idxClient.feed(oafRecord, idx.getIndexDsId(), oafToIndexRecordFactory.newTransformer(idx.getFormat()), commit);
 				} catch (final Throwable e) {
-					throw new MSROException("Error adding publication: " + e.getMessage(), e);
+					throw new DirecIndexApiException("Error adding publication: " + e.getMessage(), e);
 				} finally {
 					if (idxClient != null) {
 						idxClient.close();
@@ -145,24 +149,20 @@
 			return pub.getOpenaireId();
 		} catch (final Throwable e) {
 			log.debug(pub.toString());
-			throw new MSROException("Error adding publication: " + e.getMessage(), e);
+			throw new DirecIndexApiException("Error adding publication: " + e.getMessage(), e);
 		}
 	}
 
 	@RequestMapping(value = "/api/result/{openaireId}", method = RequestMethod.DELETE)
-	public
-	@ResponseBody
-	boolean deleteResultWithOpenaireId(
+	public @ResponseBody boolean deleteResultWithOpenaireId(
 			@PathVariable(value = "openaireId") final String openaireId,
-			@RequestParam(value = "commit", required = false, defaultValue = "true") final boolean commit) throws MSROException {
+			@RequestParam(value = "commit", required = false, defaultValue = "true") final boolean commit) throws DirecIndexApiException {
 
 		return deleteResult(openaireId, commit);
 	}
 
 	@RequestMapping(value = "/api/results", method = RequestMethod.DELETE)
-	public
-	@ResponseBody
-	boolean deleteResultWithOriginalId(
+	public @ResponseBody boolean deleteResultWithOriginalId(
 			@RequestParam(value = "originalId", required = true) final String originalId,
 			@RequestParam(value = "collectedFromId", required = true) final String collectedFromId,
 			@RequestParam(value = "commit", required = false, defaultValue = "true") final boolean commit) throws Exception {
@@ -173,9 +173,7 @@
 
 	@Deprecated
 	@RequestMapping(value = { "/api/publications/deleteObject", "/api/results/delete" }, method = RequestMethod.POST)
-	public
-	@ResponseBody
-	boolean deleteResultPost(
+	public @ResponseBody boolean deleteResultPost(
 			@RequestParam(value = "originalId", required = true) final String originalId,
 			@RequestParam(value = "collectedFromId", required = true) final String collectedFromId,
 			@RequestParam(value = "commit", required = false, defaultValue = "true") final boolean commit) throws Exception {
@@ -184,20 +182,22 @@
 		return deleteResult(openaireId, commit);
 	}
 
-	private boolean deleteResult(final String openaireId, final boolean commit) throws MSROException {
+	private boolean deleteResult(final String openaireId, final boolean commit) throws DirecIndexApiException {
 
 		final List<IndexDsInfo> idxList;
 		try {
 			idxList = calculateCurrentIndexDsInfo();
 
-			if (idxList == null || idxList.isEmpty()) {
-				throw new MSROException("Cannot delete result: " + openaireId + " : No public Search Service found");
+			if (idxList == null
+					|| idxList.isEmpty()) { throw new DirecIndexApiException("Cannot delete result: " + openaireId + " : No public Search Service found"); }
+			if (idxList.size() > 1) {
+				log.warn("Found more than 1 public search service");
 			}
-			if (idxList.size() > 1) log.warn("Found more than 1 public search service");
 
-			//			final String objId = ResultEntry.calculateOpenaireId(originalId, collectedFromId, serviceLocator.getService(ISLookUpService.class));
+			// final String objId = ResultEntry.calculateOpenaireId(originalId, collectedFromId,
+			// serviceLocator.getService(ISLookUpService.class));
 
-			for (IndexDsInfo idx : idxList) {
+			for (final IndexDsInfo idx : idxList) {
 				CloudIndexClient idxClient = null;
 				try {
 					idxClient = CloudIndexClientFactory.newIndexClient(idx.getIndexBaseUrl(), idx.getColl(), false);
@@ -204,7 +204,7 @@
 					idxClient.remove(openaireId, commit);
 					log.info("Deleted result with id: " + openaireId + " from: " + idx.getIndexBaseUrl());
 				} catch (final Throwable e) {
-					throw new MSROException("Error deleting publication: " + e.getMessage(), e);
+					throw new DirecIndexApiException("Error deleting publication: " + e.getMessage(), e);
 				} finally {
 					if (idxClient != null) {
 						idxClient.close();
@@ -214,15 +214,13 @@
 			recentResultsQueue.remove(openaireId);
 			return true;
 		} catch (IOException | ISLookUpException e) {
-			throw new MSROException("Error deleting publication: " + e.getMessage(), e);
+			throw new DirecIndexApiException("Error deleting publication: " + e.getMessage(), e);
 		}
 	}
 
 	@ExceptionHandler(Exception.class)
 	@ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR)
-	public
-	@ResponseBody
-	ErrorMessage handleException(final Exception e) {
+	public @ResponseBody ErrorMessage handleException(final Exception e) {
 		log.error("Error in direct index API", e);
 		return new ErrorMessage(e);
 	}
@@ -237,7 +235,7 @@
 		final String indexBaseUrl = lu.getResourceProfileByQuery(queryUrl);
 
 		final List<String> idxDs = lu.quickSearchProfile(queryDs);
-		for (String idx : idxDs) {
+		for (final String idx : idxDs) {
 			final String[] arr = idx.split("@@@");
 			list.add(new IndexDsInfo(indexBaseUrl, arr[0].trim(), arr[1].trim(), arr[2].trim()));
 		}
@@ -268,4 +266,4 @@
 
 	}
 
-}
\ No newline at end of file
+}
Index: modules/dnet-directindex-api/trunk/src/main/java/eu/dnetlib/msro/openaireplus/api/utils/OafToIndexRecordFactory.java
===================================================================
--- modules/dnet-directindex-api/trunk/src/main/java/eu/dnetlib/msro/openaireplus/api/utils/OafToIndexRecordFactory.java	(nonexistent)
+++ modules/dnet-directindex-api/trunk/src/main/java/eu/dnetlib/msro/openaireplus/api/utils/OafToIndexRecordFactory.java	(revision 51236)
@@ -0,0 +1,62 @@
+package eu.dnetlib.msro.openaireplus.api.utils;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.io.StringWriter;
+import javax.annotation.Resource;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpDocumentNotFoundException;
+import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException;
+import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService;
+import eu.dnetlib.enabling.locators.UniqueServiceLocator;
+import eu.dnetlib.miscutils.functional.xml.ApplyXslt;
+import org.apache.commons.io.IOUtils;
+import org.springframework.beans.factory.annotation.Required;
+import org.springframework.core.io.ClassPathResource;
+
+/**
+ * Created by michele on 15/12/15.
+ */
+public class OafToIndexRecordFactory {
+
+	private ClassPathResource layoutToRecord;
+
+	@Resource
+	private UniqueServiceLocator serviceLocator;
+
+	public ApplyXslt newTransformer(final String format) throws ISLookUpException, IOException, TransformerException {
+		final TransformerFactory factory = TransformerFactory.newInstance();
+		final Transformer layoutTransformer = factory.newTransformer(readLayoutToRecord());
+
+		final StreamResult layoutToXsltXslt = new StreamResult(new StringWriter());
+
+		layoutTransformer.setParameter("format", format);
+		layoutTransformer.transform(new StreamSource(new StringReader(getLayoutSource(format))), layoutToXsltXslt);
+
+		return new ApplyXslt(layoutToXsltXslt.getWriter().toString());
+	}
+
+	private StreamSource readLayoutToRecord() throws IOException {
+		return new StreamSource(new StringReader(IOUtils.toString(layoutToRecord.getInputStream())));
+	}
+
+	private String getLayoutSource(final String format) throws ISLookUpDocumentNotFoundException, ISLookUpException {
+		return serviceLocator.getService(ISLookUpService.class).getResourceProfileByQuery(
+				"collection('/db/DRIVER/MDFormatDSResources/MDFormatDSResourceType')[.//NAME='" + format + "']//LAYOUT[@name='index']");
+	}
+
+	public ClassPathResource getLayoutToRecord() {
+		return layoutToRecord;
+	}
+
+	@Required
+	public void setLayoutToRecord(final ClassPathResource layoutToRecord) {
+		this.layoutToRecord = layoutToRecord;
+	}
+
+}
Index: modules/dnet-directindex-api/trunk/src/main/java/eu/dnetlib/msro/openaireplus/api/DirecIndexApiException.java
===================================================================
--- modules/dnet-directindex-api/trunk/src/main/java/eu/dnetlib/msro/openaireplus/api/DirecIndexApiException.java	(nonexistent)
+++ modules/dnet-directindex-api/trunk/src/main/java/eu/dnetlib/msro/openaireplus/api/DirecIndexApiException.java	(revision 51236)
@@ -0,0 +1,24 @@
+package eu.dnetlib.msro.openaireplus.api;
+
+import eu.dnetlib.common.rmi.RMIException;
+
+public class DirecIndexApiException extends RMIException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = -3888037031334809448L;
+
+	public DirecIndexApiException(final String string) {
+		super(string);
+	}
+
+	public DirecIndexApiException(final String string, final Throwable exception) {
+		super(string, exception);
+	}
+
+	public DirecIndexApiException(final Throwable exception) {
+		super(exception);
+	}
+
+}
Index: modules/dnet-directindex-api/trunk/src/main/java/eu/dnetlib/msro/openaireplus/api/objects/ResultEntry.java
===================================================================
--- modules/dnet-directindex-api/trunk/src/main/java/eu/dnetlib/msro/openaireplus/api/objects/ResultEntry.java	(revision 51235)
+++ modules/dnet-directindex-api/trunk/src/main/java/eu/dnetlib/msro/openaireplus/api/objects/ResultEntry.java	(revision 51236)
@@ -1,23 +1,29 @@
 package eu.dnetlib.msro.openaireplus.api.objects;
 
 import java.text.SimpleDateFormat;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 import java.util.concurrent.TimeUnit;
 
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.velocity.app.VelocityEngine;
+import org.springframework.ui.velocity.VelocityEngineUtils;
+
 import com.google.gson.Gson;
+
 import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException;
 import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService;
 import eu.dnetlib.miscutils.datetime.DateUtils;
 import eu.dnetlib.miscutils.functional.hash.Hashing;
 import eu.dnetlib.miscutils.functional.string.EscapeXml;
+import eu.dnetlib.msro.openaireplus.api.DirecIndexApiException;
 import eu.dnetlib.msro.openaireplus.api.OpenAIRESubmitterUtils;
-import eu.dnetlib.msro.rmi.MSROException;
 import io.swagger.annotations.ApiModelProperty;
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.velocity.app.VelocityEngine;
-import org.springframework.ui.velocity.VelocityEngineUtils;
 
 /**
  * Created by michele on 02/12/15.
@@ -27,11 +33,11 @@
 	private String openaireId;
 	private String originalId;
 	private String title;
-	private List<String> authors = new ArrayList<String>();
+	private List<String> authors = new ArrayList<>();
 	private String publisher;
 	private String description;
 	private String language;
-	private List<PidEntry> pids = new ArrayList<PidEntry>();
+	private List<PidEntry> pids = new ArrayList<>();
 	private String licenseCode;
 	private String embargoEndDate;
 	private String type = "publication";
@@ -41,27 +47,26 @@
 	private String hostedById;
 
 	// String according to the EGI context profile, example: egi::classification::natsc::math
-	private List<String> contexts = new ArrayList<String>();
+	private List<String> contexts = new ArrayList<>();
 
 	// String according to openaire guidelines:
 	// info:eu-repo/grantAgreement/Funder/FundingProgram/ProjectID/[Jurisdiction]/[ProjectName]/[ProjectAcronym]
-	private List<String> linksToProjects = new ArrayList<String>();
+	private List<String> linksToProjects = new ArrayList<>();
 
 	private static long last_cache_update = 0;
-	private static final Map<String, Map<String, String>> cached_vocabularies = new HashMap<String, Map<String, String>>();
-	private static final Map<String, DatasourceEntry> cached_datasources = new HashMap<String, DatasourceEntry>();
-	private static final Map<String, String> cached_contexts = new HashMap<String, String>();
+	private static final Map<String, Map<String, String>> cached_vocabularies = new HashMap<>();
+	private static final Map<String, DatasourceEntry> cached_datasources = new HashMap<>();
+	private static final Map<String, String> cached_contexts = new HashMap<>();
 
 	private static final Log log = LogFactory.getLog(ResultEntry.class);
 
-	public ResultEntry() {
-	}
+	public ResultEntry() {}
 
 	public String getOpenaireId() {
 		return openaireId;
 	}
 
-	public void setOpenaireId(String openaireId) {
+	public void setOpenaireId(final String openaireId) {
 		this.openaireId = openaireId;
 	}
 
@@ -206,15 +211,15 @@
 			final ISLookUpService lookupService,
 			final String oafSchemaLocation) throws Exception {
 
-		if (StringUtils.isBlank(getOriginalId()) && StringUtils.isBlank(getOpenaireId())) {
-			throw new MSROException("One of the following fields is required: originalId or openaireId");
-		}
-		if (StringUtils.isBlank(getTitle())) { throw new MSROException("A required field is missing: title"); }
-		if (StringUtils.isBlank(getUrl())) { throw new MSROException("A required field is missing: url"); }
-		if (StringUtils.isBlank(getLicenseCode())) { throw new MSROException("A required field is missing: licenseCode"); }
-		if (StringUtils.isBlank(getResourceType())) { throw new MSROException("A required field is missing: resourceType"); }
-		if (StringUtils.isBlank(getCollectedFromId())) { throw new MSROException("A required field is missing: collectedFromId"); }
-		if (StringUtils.isBlank(getType())) { throw new MSROException("A required field is missing: type"); }
+		if (StringUtils.isBlank(getOriginalId())
+				&& StringUtils
+						.isBlank(getOpenaireId())) { throw new DirecIndexApiException("One of the following fields is required: originalId or openaireId"); }
+		if (StringUtils.isBlank(getTitle())) { throw new DirecIndexApiException("A required field is missing: title"); }
+		if (StringUtils.isBlank(getUrl())) { throw new DirecIndexApiException("A required field is missing: url"); }
+		if (StringUtils.isBlank(getLicenseCode())) { throw new DirecIndexApiException("A required field is missing: licenseCode"); }
+		if (StringUtils.isBlank(getResourceType())) { throw new DirecIndexApiException("A required field is missing: resourceType"); }
+		if (StringUtils.isBlank(getCollectedFromId())) { throw new DirecIndexApiException("A required field is missing: collectedFromId"); }
+		if (StringUtils.isBlank(getType())) { throw new DirecIndexApiException("A required field is missing: type"); }
 
 		final DatasourceEntry collectedFromEntry = getDatasourceInfo(collectedFromId, lookupService);
 		final DatasourceEntry hostedByEntry = getDatasourceInfo(hostedById, lookupService);
@@ -223,11 +228,11 @@
 			setOpenaireId(calculateOpenaireId(originalId, collectedFromEntry));
 		}
 
-		if (!openaireId.matches("^\\w{12}::\\w{32}$")) {
-			throw new MSROException("Invalid openaireId: " + openaireId + " - regex ^\\w{12}::\\w{32}$ not matched");
-		}
+		if (!openaireId
+				.matches("^\\w{12}::\\w{32}$")) { throw new DirecIndexApiException(
+						"Invalid openaireId: " + openaireId + " - regex ^\\w{12}::\\w{32}$ not matched"); }
 
-		final Map<String, Object> model = new HashMap<String, Object>();
+		final Map<String, Object> model = new HashMap<>();
 		model.put("esc", new EscapeXml());
 		model.put("util", new OpenAIRESubmitterUtils());
 		model.put("pub", this);
@@ -239,7 +244,7 @@
 		model.put("pidTypes", getVocabulary("dnet:pid_types", lookupService));
 		model.put("languages", getVocabulary("dnet:languages", lookupService));
 		model.put("contexts", getContexts(lookupService));
-		model.put("dateOfCollection", (new SimpleDateFormat("yyyy-MM-dd\'T\'hh:mm:ss\'Z\'")).format(new Date()));
+		model.put("dateOfCollection", new SimpleDateFormat("yyyy-MM-dd\'T\'hh:mm:ss\'Z\'").format(new Date()));
 		model.put("collectedFrom", collectedFromEntry);
 		model.put("hostedBy", hostedByEntry);
 
@@ -282,13 +287,13 @@
 
 	private synchronized static Map<String, String> getVocabulary(final String voc, final ISLookUpService lookupService) throws ISLookUpException {
 
-		if (((DateUtils.now() - last_cache_update) < TimeUnit.MINUTES.toMillis(15)) && cached_vocabularies.containsKey(voc)) {
+		if (DateUtils.now() - last_cache_update < TimeUnit.MINUTES.toMillis(15) && cached_vocabularies.containsKey(voc)) {
 			return cached_vocabularies.get(voc);
 		} else {
 			final String query = "collection('/db/DRIVER/VocabularyDSResources/VocabularyDSResourceType')[.//VOCABULARY_NAME/@code='" + voc
 					+ "']//TERM/concat(@code, ' @@@ ', @english_name)";
 
-			final Map<String, String> map = new HashMap<String, String>();
+			final Map<String, String> map = new HashMap<>();
 			for (final String s : lookupService.quickSearchProfile(query)) {
 				final String[] arr = s.split("@@@");
 				map.put(arr[0].trim(), arr[1].trim());
@@ -303,7 +308,7 @@
 	}
 
 	private synchronized static Map<String, String> getContexts(final ISLookUpService lookupService) throws ISLookUpException {
-		if (((DateUtils.now() - last_cache_update) > TimeUnit.MINUTES.toMillis(15)) || cached_contexts.isEmpty()) {
+		if (DateUtils.now() - last_cache_update > TimeUnit.MINUTES.toMillis(15) || cached_contexts.isEmpty()) {
 			final String query =
 					"collection('/db/DRIVER/ContextDSResources/ContextDSResourceType')[.//context/@type='community']//*[name()='context' or name()='category' or name()='concept']/concat(@id, ' @@@ ', @label)";
 
@@ -322,7 +327,7 @@
 		return new Gson().toJson(this);
 	}
 
-	public String getAnyId(){
+	public String getAnyId() {
 		return StringUtils.isNotBlank(openaireId) ? openaireId : originalId;
 	}
-}
\ No newline at end of file
+}
Index: modules/dnet-directindex-api/trunk/pom.xml
===================================================================
--- modules/dnet-directindex-api/trunk/pom.xml	(revision 51235)
+++ modules/dnet-directindex-api/trunk/pom.xml	(revision 51236)
@@ -18,37 +18,6 @@
 	<dependencies>
 		<dependency>
 			<groupId>eu.dnetlib</groupId>
-			<artifactId>cnr-data-flow-monitoring-core</artifactId>
-			<version>[2.0.0,3.0.0)</version>
-			<exclusions>
-				<exclusion>
-					<artifactId>wstx-asl</artifactId>
-					<groupId>org.codehaus.woodstox</groupId>
-				</exclusion>
-			</exclusions>
-		</dependency>
-		<dependency>
-			<groupId>eu.dnetlib</groupId>
-			<artifactId>cnr-enabling-database-api</artifactId>
-			<version>[2.0.0,3.0.0)</version>
-		</dependency>
-		<dependency>
-			<groupId>eu.dnetlib</groupId>
-			<artifactId>cnr-enabling-database-service</artifactId>
-			<version>[3.0.0,4.0.0)</version>
-		</dependency>
-		<dependency>
-			<groupId>eu.dnetlib</groupId>
-			<artifactId>dnet-msro-service</artifactId>
-			<version>[3.0.0,4.0.0)</version>
-		</dependency>
-		<dependency>
-			<groupId>eu.dnetlib</groupId>
-			<artifactId>cnr-resultset-service</artifactId>
-			<version>[2.0.0,3.0.0)</version>
-		</dependency>
-		<dependency>
-			<groupId>eu.dnetlib</groupId>
 			<artifactId>dnet-openaire-datasource-manager</artifactId>
 			<version>[1.0.0-SNAPSHOT,2.0.0)</version>
 		</dependency>
@@ -59,57 +28,30 @@
 		</dependency>
 		<dependency>
 			<groupId>eu.dnetlib</groupId>
-			<artifactId>dnet-hadoop-service-rmi</artifactId>
-			<version>[1.0.0,2.0.0)</version>
-		</dependency>
-		<dependency>
-			<groupId>eu.dnetlib</groupId>
 			<artifactId>dnet-index-solr-common</artifactId>
 			<version>[1.0.0,2.0.0)</version>
 		</dependency>
 		<dependency>
 			<groupId>eu.dnetlib</groupId>
-			<artifactId>dnet-collector-plugins</artifactId>
-			<version>[1.0.0,2.0.0)</version>
-		</dependency>
-
-		<dependency>
-			<groupId>eu.dnetlib</groupId>
-			<artifactId>dnet-actionmanager-api</artifactId>
-			<version>[4.0.0,5.0.0)</version>
-		</dependency>
-
-		<dependency>
-			<groupId>eu.dnetlib</groupId>
-			<artifactId>dnet-oai-common-workflows</artifactId>
-			<version>[5.0.0,6.0.0)</version>
-		</dependency>
-
-		<dependency>
-			<groupId>eu.dnetlib</groupId>
 			<artifactId>dnet-index-solr-client</artifactId>
 			<version>[2.0.0,2.9.9)</version>
 		</dependency>
-
 		<dependency>
-			<groupId>eu.dnetlib</groupId>
-			<artifactId>dnet-validator-workflows</artifactId>
-			<version>[1.0.0,2.0.0)</version>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<version>${junit.version}</version>
+			<scope>test</scope>
 		</dependency>
-
 		<dependency>
-			<groupId>eu.dnetlib</groupId>
-			<artifactId>dnet-deduplication</artifactId>
-			<version>[1.0.0,2.0.0)</version>
+			<groupId>io.springfox</groupId>
+			<artifactId>springfox-swagger2</artifactId>
+			<version>${springfox-version}</version>
 		</dependency>
-
-		<!-- modular ui and servlet api are here because of the stats controller -->
 		<dependency>
-			<groupId>eu.dnetlib</groupId>
-			<artifactId>dnet-modular-vocabularies-ui</artifactId>
-			<version>[2.0.0,3.0.0)</version>
+			<groupId>org.mockito</groupId>
+			<artifactId>mockito-core</artifactId>
+			<version>1.9.5</version>
 		</dependency>
-
 		<dependency>
 			<groupId>org.apache.velocity</groupId>
 			<artifactId>velocity</artifactId>
@@ -132,45 +74,6 @@
 				</exclusion>
 			</exclusions>
 		</dependency>
-		<dependency>
-			<groupId>javax.servlet</groupId>
-			<artifactId>javax.servlet-api</artifactId>
-			<version>${javax.servlet.version}</version>
-			<scope>provided</scope>
-		</dependency>
-		<dependency>
-			<groupId>junit</groupId>
-			<artifactId>junit</artifactId>
-			<version>${junit.version}</version>
-			<scope>test</scope>
-		</dependency>
-		<dependency>
-			<groupId>eu.dnetlib</groupId>
-			<artifactId>dnet-openaireplus-profiles</artifactId>
-			<version>[1.0.0,2.0.0)</version>
-			<scope>test</scope>
-		</dependency>
-		<dependency>
-			<groupId>io.springfox</groupId>
-			<artifactId>springfox-swagger2</artifactId>
-			<version>${springfox-version}</version>
-		</dependency>
-		<dependency>
-			<groupId>org.mockito</groupId>
-			<artifactId>mockito-core</artifactId>
-			<version>1.9.5</version>
-		</dependency>
-		<dependency>
-			<groupId>org.springframework</groupId>
-			<artifactId>spring-jdbc</artifactId>
-			<version>${spring.version}</version>
-		</dependency>
-
-		<dependency>
-			<groupId>eu.dnetlib</groupId>
-			<artifactId>cnr-misc-utils</artifactId>
-			<version>[1.0.5, 2.0.0)</version>
-		</dependency>
 	</dependencies>
 
 	<properties>
