Project

General

Profile

« Previous | Next » 

Revision 61355

Need to create an instance of the OpenAIRESUbmitterUtils for the new class ResultEntryToOaf.

View differences:

modules/dnet-directindex-api/trunk/src/test/java/eu/dnetlib/openaire/directindex/objects/ResultEntryToOafTest.java
56 56

  
57 57

  
58 58

  
59
		toOaf = new ResultEntryToOaf();
59
		toOaf = new ResultEntryToOaf(community_api);
60 60
		toOaf.setUtils(utils);
61 61

  
62 62
		final Properties props = new Properties();
......
122 122
		pub.getContexts().add("egi::classification::natsc::math::stats");
123 123
		pub.getContexts().add("enermaps");
124 124
		pub.getContexts().add("enermaps::selection");
125
		final String xml = toOaf.asOafRecord(pub, ve, lookUpService, "http://oaf/oaf.xsd",community_api);
125
		final String xml = toOaf.asOafRecord(pub, ve, lookUpService, "http://oaf/oaf.xsd");
126 126

  
127 127
		final Document doc = new SAXReader().read(new StringReader(xml));
128 128

  
......
159 159
		pub.getLinksToProjects().add("info:eu-repo/grantAgreement/EC/FP7/244909/EU/Making Capabilities Work/WorkAble");
160 160
		pub.getContexts().add("egi::classification::natsc::math::pure");
161 161
		pub.getContexts().add("egi::classification::natsc::math::stats");
162
		final String xml = toOaf.asOafRecord(pub,ve, lookUpService, "http://oaf/oaf.xsd",community_api);
162
		final String xml = toOaf.asOafRecord(pub,ve, lookUpService, "http://oaf/oaf.xsd");
163 163

  
164 164
		final Document doc = new SAXReader().read(new StringReader(xml));
165 165

  
......
197 197
		pub.getLinksToProjects().add("info:eu-repo/grantAgreement/EC/FP7/244909/EU/Making Capabilities Work/WorkAble");
198 198
		pub.getContexts().add("egi::classification::natsc::math::pure");
199 199
		pub.getContexts().add("egi::classification::natsc::math::stats");
200
		final String xml = toOaf.asOafRecord(pub,ve, lookUpService, "http://oaf/oaf.xsd",community_api);
200
		final String xml = toOaf.asOafRecord(pub,ve, lookUpService, "http://oaf/oaf.xsd");
201 201

  
202 202
		final Document doc = new SAXReader().read(new StringReader(xml));
203 203

  
......
271 271
				new Gson().fromJson(new InputStreamReader(getClass().getResourceAsStream(filename)), ResultEntry.class);
272 272

  
273 273

  
274
		final String xml = toOaf.asOafRecord(pub,ve, lookUpService, "http://oaf/oaf.xsd",community_api);
274
		final String xml = toOaf.asOafRecord(pub,ve, lookUpService, "http://oaf/oaf.xsd");
275 275
		//System.out.println(xml);
276 276

  
277 277
		final Document doc = new SAXReader().read(new StringReader(xml));
modules/dnet-directindex-api/trunk/src/main/java/eu/dnetlib/openaire/directindex/api/OpenaireResultSubmitter.java
144 144
	private String feed(final ResultEntry pub) throws DirecIndexApiException {
145 145
		log.debug(pub);
146 146
		try {
147
			ResultEntryToOaf toOaf = new ResultEntryToOaf();
147
			ResultEntryToOaf toOaf = new ResultEntryToOaf(community_api);
148 148
			final IndexDsInfo info = indexDSRetriever.calculateCurrentIndexDsInfo();
149
			final String oafRecord = toOaf.asOafRecord(pub, velocityEngine, serviceLocator.getService(ISLookUpService.class), oafSchemaLocation, community_api);
149
			final String oafRecord = toOaf.asOafRecord(pub, velocityEngine, serviceLocator.getService(ISLookUpService.class), oafSchemaLocation);
150 150
			final SolrInputDocument solrDocument = prepareSolrDocument(oafRecord, info.getIndexDsId(), oafToIndexRecordFactory.newTransformer(info.getFormat()));
151 151

  
152 152
			clientManager.getClient(info).add(solrDocument);
modules/dnet-directindex-api/trunk/src/main/java/eu/dnetlib/openaire/directindex/objects/ResultEntryToOaf.java
31 31

  
32 32
    private OpenAIRESubmitterUtils utils;
33 33

  
34
    public ResultEntryToOaf(final String community_api){
35
        utils = new OpenAIRESubmitterUtils(community_api);
36
    }
37

  
34 38
    public String asOafRecord(final ResultEntry entry, final VelocityEngine ve,
35 39
                              final ISLookUpService lookupService,
36
                              final String oafSchemaLocation,
37
                              final String community_api) throws Exception {
40
                              final String oafSchemaLocation) throws Exception {
38 41

  
39 42
        if (StringUtils.isBlank(entry.getOriginalId())
40 43
                && StringUtils

Also available in: Unified diff