All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.julielab.medline.MedlineDataTableDocumentDeleter Maven / Gradle / Ivy

Go to download

A utility for managing documents stored in a PostgreSQL database. The documents are imported into a PostgreSQL DB as full texts with the goal to be able to retrieve the documents by their PubMedID efficiently. For more sophisticated tasks, a user configuration file can be delivered which can take control of the table schema to use, the PostgreSQL schema to use and the actual database server to connect to as well as the concrete database.

There is a newer version: 1.6.2
Show newest version
package de.julielab.medline;

import de.julielab.xmlData.Constants;
import de.julielab.xmlData.dataBase.DataBaseConnector;
import org.apache.commons.configuration2.HierarchicalConfiguration;
import org.apache.commons.configuration2.tree.ImmutableNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class MedlineDataTableDocumentDeleter implements IDocumentDeleter {

	
	private static final Logger log = LoggerFactory.getLogger(MedlineDataTableDocumentDeleter.class);
	
	private DataBaseConnector dbc;


	public void setDbc(DataBaseConnector dbc) {
		this.dbc = dbc;
	}

	@Override
	public void deleteDocuments(List docIds) {
		log.info(
				"Deleting {} documents marked for deletion in update file from table \"{}\".",
				docIds.size(), Constants.DEFAULT_DATA_TABLE_NAME);
		dbc.deleteFromTableSimplePK(Constants.DEFAULT_DATA_TABLE_NAME, docIds);
	}

	@Override
	public void configure(HierarchicalConfiguration deletionConfiguration)
			throws MedlineDocumentDeletionException {
		
	}

	@Override
	public Set getNames() {
		return new HashSet<>(Arrays.asList("medline", getClass().getCanonicalName()));
	}


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy