modified access protocol parameter name (mandatory for aat and periodo), it is the name of the root node, inside the metadata record, that is generated converting original json record
This commit is contained in:
parent
a005328dfe
commit
996150a315
|
@ -35,7 +35,7 @@ public class FileJSONCollectorPlugin extends FileCollectorPlugin {
|
|||
public Iterable<String> collect(final InterfaceDescriptor interfaceDescriptor, final String fromDate, final String untilDate)
|
||||
throws CollectorServiceException {
|
||||
log.info("FileJSONCollectorPlugin");
|
||||
final String identifierFieldKey = interfaceDescriptor.getParams().get("identifierFieldKey");
|
||||
final String metadataRootNodeName = interfaceDescriptor.getParams().get("metadataRootNodeName");
|
||||
|
||||
URL u = null;
|
||||
try {
|
||||
|
@ -54,7 +54,7 @@ public class FileJSONCollectorPlugin extends FileCollectorPlugin {
|
|||
|
||||
@Override
|
||||
public Iterator<String> iterator() {
|
||||
return new FileJSONIterator(fileReader, identifierFieldKey);
|
||||
return new FileJSONIterator(fileReader, metadataRootNodeName);
|
||||
}
|
||||
};
|
||||
} catch (Exception e) {
|
||||
|
@ -66,12 +66,12 @@ public class FileJSONCollectorPlugin extends FileCollectorPlugin {
|
|||
class FileJSONIterator implements Iterator<String> {
|
||||
|
||||
private String next;
|
||||
private String identifierFieldKey;
|
||||
private String metadataRootNodeName;
|
||||
private Iterator<JsonElement> aatInfosIterator;
|
||||
private JsonReader jsonReader;
|
||||
|
||||
public FileJSONIterator(final FileReader fileReader, final String identifierFieldKey) {
|
||||
this.identifierFieldKey = identifierFieldKey;
|
||||
public FileJSONIterator(final FileReader fileReader, final String metadataRootNodeName) {
|
||||
this.metadataRootNodeName = metadataRootNodeName;
|
||||
jsonReader = new JsonReader(fileReader);
|
||||
JsonElement jsonElement = new JsonParser().parse(jsonReader);
|
||||
JsonArray jsonArrays = jsonElement.getAsJsonArray();
|
||||
|
@ -94,7 +94,7 @@ public class FileJSONCollectorPlugin extends FileCollectorPlugin {
|
|||
private String calculateNext() {
|
||||
try {
|
||||
Document document = DocumentHelper.createDocument();
|
||||
Element root = document.addElement("Entry");
|
||||
Element root = document.addElement(this.metadataRootNodeName);
|
||||
|
||||
if (!aatInfosIterator.hasNext()) {
|
||||
log.info("json entries finished, closing RESULT SET");
|
||||
|
|
|
@ -15,13 +15,13 @@ import eu.dnetlib.rmi.data.CollectorServiceException;
|
|||
import eu.dnetlib.rmi.data.InterfaceDescriptor;
|
||||
|
||||
|
||||
public class AATCollectorPlugin extends FileJSONCollectorPlugin {
|
||||
public class FolderCollectorPlugin extends FileJSONCollectorPlugin {
|
||||
|
||||
private Iterator<String> recordIterator;
|
||||
private URL basePath;
|
||||
|
||||
/** The Constant log. */
|
||||
private static final Log log = LogFactory.getLog(AATCollectorPlugin.class);
|
||||
private static final Log log = LogFactory.getLog(FolderCollectorPlugin.class);
|
||||
|
||||
@Override
|
||||
public Iterable<String> collect(final InterfaceDescriptor interfaceDescriptor, final String fromDate, final String untilDate)
|
||||
|
@ -33,7 +33,7 @@ public class AATCollectorPlugin extends FileJSONCollectorPlugin {
|
|||
try {
|
||||
basePath = new URL(url);
|
||||
} catch (MalformedURLException mue) {
|
||||
log.error("Failed collecting json aat from base url " + url, mue);
|
||||
log.error("Failed collecting json from base url " + url, mue);
|
||||
throw new CollectorServiceException(mue);
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ public class AATCollectorPlugin extends FileJSONCollectorPlugin {
|
|||
recordIterator = Iterators.concat(recordIterator, super.collect(interfaceDescriptor, fromDate, untilDate).iterator());
|
||||
}
|
||||
} catch (CollectorServiceException e) {
|
||||
log.error("Failed collecting json aat from path: " + nextFilePath, e);
|
||||
log.error("Failed collecting json from path: " + nextFilePath, e);
|
||||
}
|
||||
}
|
||||
return new ADSIterable(recordIterator);
|
|
@ -17,13 +17,25 @@
|
|||
</bean>
|
||||
</property>
|
||||
</bean>
|
||||
<bean id="aatCollectorPlugin" class="eu.dnetlib.data.collector.plugins.ariadneplus.ads.AATCollectorPlugin">
|
||||
<bean id="aatCollectorPlugin" class="eu.dnetlib.data.collector.plugins.ariadneplus.ads.FolderCollectorPlugin">
|
||||
<property name="protocolDescriptor">
|
||||
<bean class="eu.dnetlib.rmi.data.ProtocolDescriptor" p:name="aat">
|
||||
<property name="params">
|
||||
<list>
|
||||
<bean class="eu.dnetlib.rmi.data.ProtocolParameter"
|
||||
p:name="identifierFieldKey"/>
|
||||
p:name="metadataRootNodeName"/>
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
</property>
|
||||
</bean>
|
||||
<bean id="periodoCollectorPlugin" class="eu.dnetlib.data.collector.plugins.ariadneplus.ads.FolderCollectorPlugin">
|
||||
<property name="protocolDescriptor">
|
||||
<bean class="eu.dnetlib.rmi.data.ProtocolDescriptor" p:name="periodo">
|
||||
<property name="params">
|
||||
<list>
|
||||
<bean class="eu.dnetlib.rmi.data.ProtocolParameter"
|
||||
p:name="metadataRootNodeName"/>
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
|
|
Loading…
Reference in New Issue