mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-10 11:33:11 +00:00
Merged configurable_entities into w2p-57159_permission-to-create-relations
This commit is contained in:
@@ -366,7 +366,6 @@ https://wiki.duraspace.org/display/DSPACE/Code+Contribution+Guidelines
|
||||
* FindBugs-Annotations (com.google.code.findbugs:annotations:3.0.1u2 - http://findbugs.sourceforge.net/)
|
||||
* MaxMind GeoIP Legacy API (com.maxmind.geoip:geoip-api:1.3.0 - https://github.com/maxmind/geoip-api-java)
|
||||
* JHighlight (com.uwyn:jhighlight:1.0 - https://jhighlight.dev.java.net/)
|
||||
* DSpace TM-Extractors Dependency (org.dspace.dependencies:dspace-tm-extractors:1.0.1 - http://projects.dspace.org/dspace-pom/dspace-tm-extractors)
|
||||
* A Hibernate O/RM Module (org.hibernate:hibernate-core:4.2.21.Final - http://hibernate.org)
|
||||
* A Hibernate O/RM Module (org.hibernate:hibernate-ehcache:4.2.21.Final - http://hibernate.org)
|
||||
* Hibernate Commons Annotations (org.hibernate.common:hibernate-commons-annotations:4.0.2.Final - http://hibernate.org)
|
||||
|
@@ -343,14 +343,28 @@
|
||||
<groupId>org.dspace</groupId>
|
||||
<artifactId>mets</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dspace.dependencies</groupId>
|
||||
<artifactId>dspace-tm-extractors</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.jena</groupId>
|
||||
<artifactId>apache-jena-libs</artifactId>
|
||||
<type>pom</type>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-cli</groupId>
|
||||
@@ -364,10 +378,6 @@
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-collections4</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-collections4</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-dbcp2</artifactId>
|
||||
@@ -382,8 +392,8 @@
|
||||
<artifactId>commons-io</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
@@ -399,7 +409,7 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@@ -417,8 +427,16 @@
|
||||
<artifactId>jdom</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-1.2-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>oro</groupId>
|
||||
@@ -530,6 +548,10 @@
|
||||
<exclusion>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
@@ -547,6 +569,10 @@
|
||||
<exclusion>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
@@ -575,8 +601,8 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-configuration</groupId>
|
||||
<artifactId>commons-configuration</artifactId>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-configuration2</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.maxmind.geoip2</groupId>
|
||||
@@ -615,7 +641,6 @@
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>19.0</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
@@ -15,7 +15,7 @@ import org.apache.commons.cli.CommandLine;
|
||||
import org.apache.commons.cli.CommandLineParser;
|
||||
import org.apache.commons.cli.Options;
|
||||
import org.apache.commons.cli.PosixParser;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.dspace.core.ConfigurationManager;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.I18nUtil;
|
||||
|
@@ -21,6 +21,7 @@ import org.apache.xpath.XPathAPI;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.content.MetadataField;
|
||||
import org.dspace.content.MetadataSchema;
|
||||
import org.dspace.content.MetadataSchemaEnum;
|
||||
import org.dspace.content.NonUniqueMetadataException;
|
||||
import org.dspace.content.factory.ContentServiceFactory;
|
||||
import org.dspace.content.service.MetadataFieldService;
|
||||
@@ -248,7 +249,7 @@ public class MetadataImporter {
|
||||
|
||||
// If the schema is not provided default to DC
|
||||
if (schema == null) {
|
||||
schema = MetadataSchema.DC_SCHEMA;
|
||||
schema = MetadataSchemaEnum.DC.getName();
|
||||
}
|
||||
|
||||
|
||||
|
@@ -17,7 +17,7 @@ import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.transform.TransformerException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.xpath.XPathAPI;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.content.BitstreamFormat;
|
||||
@@ -47,7 +47,7 @@ public class RegistryLoader {
|
||||
/**
|
||||
* log4j category
|
||||
*/
|
||||
private static Logger log = Logger.getLogger(RegistryLoader.class);
|
||||
private static Logger log = org.apache.logging.log4j.LogManager.getLogger(RegistryLoader.class);
|
||||
|
||||
protected static BitstreamFormatService bitstreamFormatService = ContentServiceFactory.getInstance()
|
||||
.getBitstreamFormatService();
|
||||
|
@@ -27,7 +27,7 @@ import java.util.UUID;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.dspace.authority.AuthorityValue;
|
||||
import org.dspace.authority.factory.AuthorityServiceFactory;
|
||||
import org.dspace.authority.service.AuthorityValueService;
|
||||
@@ -35,6 +35,7 @@ import org.dspace.content.Collection;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.content.MetadataField;
|
||||
import org.dspace.content.MetadataSchema;
|
||||
import org.dspace.content.MetadataSchemaEnum;
|
||||
import org.dspace.content.MetadataValue;
|
||||
import org.dspace.content.authority.Choices;
|
||||
import org.dspace.content.factory.ContentServiceFactory;
|
||||
@@ -199,7 +200,7 @@ public class DSpaceCSV implements Serializable {
|
||||
}
|
||||
|
||||
// Check that the scheme exists
|
||||
if (!StringUtils.equals(metadataSchema, "relation")) {
|
||||
if (!StringUtils.equals(metadataSchema, MetadataSchemaEnum.RELATION.getName())) {
|
||||
MetadataSchema foundSchema = metadataSchemaService.find(c, metadataSchema);
|
||||
if (foundSchema == null) {
|
||||
throw new MetadataImportInvalidHeadingException(clean[0],
|
||||
|
@@ -26,8 +26,8 @@ import org.apache.commons.cli.HelpFormatter;
|
||||
import org.apache.commons.cli.Options;
|
||||
import org.apache.commons.cli.ParseException;
|
||||
import org.apache.commons.cli.PosixParser;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.authority.AuthorityValue;
|
||||
import org.dspace.authority.factory.AuthorityServiceFactory;
|
||||
import org.dspace.authority.service.AuthorityValueService;
|
||||
@@ -37,6 +37,7 @@ import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.content.Entity;
|
||||
import org.dspace.content.EntityType;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.content.MetadataSchemaEnum;
|
||||
import org.dspace.content.MetadataValue;
|
||||
import org.dspace.content.Relationship;
|
||||
import org.dspace.content.RelationshipType;
|
||||
@@ -102,7 +103,7 @@ public class MetadataImport {
|
||||
/**
|
||||
* Logger
|
||||
*/
|
||||
protected static final Logger log = Logger.getLogger(MetadataImport.class);
|
||||
protected static final Logger log = org.apache.logging.log4j.LogManager.getLogger(MetadataImport.class);
|
||||
|
||||
protected final AuthorityValueService authorityValueService;
|
||||
|
||||
@@ -356,7 +357,7 @@ public class MetadataImport {
|
||||
// Add the metadata to the item
|
||||
List<BulkEditMetadataValue> relationships = new LinkedList<>();
|
||||
for (BulkEditMetadataValue dcv : whatHasChanged.getAdds()) {
|
||||
if (StringUtils.equals(dcv.getSchema(), "relation")) {
|
||||
if (StringUtils.equals(dcv.getSchema(), MetadataSchemaEnum.RELATION.getName())) {
|
||||
|
||||
if (!StringUtils.equals(dcv.getElement(), "type")) {
|
||||
relationships.add(dcv);
|
||||
@@ -637,14 +638,12 @@ public class MetadataImport {
|
||||
}
|
||||
|
||||
|
||||
if (StringUtils.equals(schema, "relation")) {
|
||||
if (StringUtils.equals(schema, MetadataSchemaEnum.RELATION.getName())) {
|
||||
List<RelationshipType> relationshipTypeList = relationshipTypeService
|
||||
.findByLeftOrRightLabel(c, element);
|
||||
.findByLeftOrRightLabel(c, element);
|
||||
for (RelationshipType relationshipType : relationshipTypeList) {
|
||||
for (Relationship relationship : relationshipService
|
||||
.findByItemAndRelationshipType(c,
|
||||
item,
|
||||
relationshipType)) {
|
||||
.findByItemAndRelationshipType(c, item, relationshipType)) {
|
||||
relationshipService.delete(c, relationship);
|
||||
relationshipService.update(c, relationship);
|
||||
}
|
||||
@@ -705,11 +704,12 @@ public class MetadataImport {
|
||||
boolean left = false;
|
||||
List<RelationshipType> acceptableRelationshipTypes = new LinkedList<>();
|
||||
String url = handleService.resolveToURL(c, value);
|
||||
if (UUIDUtils.fromString(value) == null && StringUtils.isNotBlank(url)) {
|
||||
UUID uuid = UUIDUtils.fromString(value);
|
||||
if (uuid == null && StringUtils.isNotBlank(url)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Entity relationEntity = entityService.findByItemId(c, UUID.fromString(value));
|
||||
Entity relationEntity = entityService.findByItemId(c, uuid);
|
||||
|
||||
|
||||
List<RelationshipType> leftRelationshipTypesForEntity = entityService.getLeftRelationshipTypes(c, entity);
|
||||
@@ -767,7 +767,7 @@ public class MetadataImport {
|
||||
}
|
||||
relationship.setRelationshipType(acceptedRelationshipType);
|
||||
relationship.setLeftPlace(relationshipService.findLeftPlaceByLeftItem(c, relationship.getLeftItem()) + 1);
|
||||
relationship.setRightPlace(relationshipService.findRightPlaceByRightItem(c, relationship.getLeftItem()) + 1);
|
||||
relationship.setRightPlace(relationshipService.findRightPlaceByRightItem(c, relationship.getRightItem()) + 1);
|
||||
Relationship persistedRelationship = relationshipService.create(c, relationship);
|
||||
relationshipService.update(c, persistedRelationship);
|
||||
}
|
||||
|
@@ -23,7 +23,8 @@ import org.apache.commons.cli.OptionBuilder;
|
||||
import org.apache.commons.cli.Options;
|
||||
import org.apache.commons.cli.ParseException;
|
||||
import org.apache.commons.cli.PosixParser;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.checker.BitstreamDispatcher;
|
||||
import org.dspace.checker.CheckerCommand;
|
||||
import org.dspace.checker.HandleDispatcher;
|
||||
@@ -48,7 +49,7 @@ import org.dspace.core.Utils;
|
||||
* @author Nathan Sarr
|
||||
*/
|
||||
public final class ChecksumChecker {
|
||||
private static final Logger LOG = Logger.getLogger(ChecksumChecker.class);
|
||||
private static final Logger LOG = LogManager.getLogger(ChecksumChecker.class);
|
||||
|
||||
private static final BitstreamService bitstreamService = ContentServiceFactory.getInstance().getBitstreamService();
|
||||
|
||||
|
@@ -32,8 +32,8 @@ import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
import javax.mail.MessagingException;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.app.itemexport.service.ItemExportService;
|
||||
import org.dspace.content.Bitstream;
|
||||
import org.dspace.content.Bundle;
|
||||
@@ -42,7 +42,7 @@ import org.dspace.content.Community;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.content.MetadataField;
|
||||
import org.dspace.content.MetadataSchema;
|
||||
import org.dspace.content.MetadataSchemaEnum;
|
||||
import org.dspace.content.MetadataValue;
|
||||
import org.dspace.content.service.BitstreamService;
|
||||
import org.dspace.content.service.CommunityService;
|
||||
@@ -98,7 +98,7 @@ public class ItemExportServiceImpl implements ItemExportService {
|
||||
/**
|
||||
* log4j logger
|
||||
*/
|
||||
private Logger log = Logger.getLogger(ItemExportServiceImpl.class);
|
||||
private Logger log = org.apache.logging.log4j.LogManager.getLogger(ItemExportServiceImpl.class);
|
||||
|
||||
protected ItemExportServiceImpl() {
|
||||
|
||||
@@ -214,7 +214,7 @@ public class ItemExportServiceImpl implements ItemExportService {
|
||||
protected void writeMetadata(Context c, String schema, Item i,
|
||||
File destDir, boolean migrate) throws Exception {
|
||||
String filename;
|
||||
if (schema.equals(MetadataSchema.DC_SCHEMA)) {
|
||||
if (schema.equals(MetadataSchemaEnum.DC.getName())) {
|
||||
filename = "dublin_core.xml";
|
||||
} else {
|
||||
filename = "metadata_" + schema + ".xml";
|
||||
|
@@ -55,10 +55,10 @@ import gr.ekt.bteio.loaders.OAIPMHDataLoader;
|
||||
import org.apache.commons.collections4.ComparatorUtils;
|
||||
import org.apache.commons.io.FileDeleteStrategy;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.lang.RandomStringUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang3.RandomStringUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.xpath.XPathAPI;
|
||||
import org.dspace.app.itemimport.service.ItemImportService;
|
||||
import org.dspace.app.util.LocalSchemaFilenameFilter;
|
||||
@@ -74,6 +74,7 @@ import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.content.MetadataField;
|
||||
import org.dspace.content.MetadataSchema;
|
||||
import org.dspace.content.MetadataSchemaEnum;
|
||||
import org.dspace.content.WorkspaceItem;
|
||||
import org.dspace.content.service.BitstreamFormatService;
|
||||
import org.dspace.content.service.BitstreamService;
|
||||
@@ -124,7 +125,7 @@ import org.xml.sax.SAXException;
|
||||
* allow the registration of files (bitstreams) into DSpace.
|
||||
*/
|
||||
public class ItemImportServiceImpl implements ItemImportService, InitializingBean {
|
||||
private final Logger log = Logger.getLogger(ItemImportServiceImpl.class);
|
||||
private final Logger log = org.apache.logging.log4j.LogManager.getLogger(ItemImportServiceImpl.class);
|
||||
|
||||
@Autowired(required = true)
|
||||
protected AuthorizeService authorizeService;
|
||||
@@ -677,7 +678,7 @@ public class ItemImportServiceImpl implements ItemImportService, InitializingBea
|
||||
Node schemaAttr = metadata.item(0).getAttributes().getNamedItem(
|
||||
"schema");
|
||||
if (schemaAttr == null) {
|
||||
schema = MetadataSchema.DC_SCHEMA;
|
||||
schema = MetadataSchemaEnum.DC.getName();
|
||||
} else {
|
||||
schema = schemaAttr.getNodeValue();
|
||||
}
|
||||
|
@@ -30,7 +30,7 @@ import javax.xml.transform.TransformerConfigurationException;
|
||||
import javax.xml.transform.TransformerException;
|
||||
import javax.xml.transform.TransformerFactory;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.app.util.LocalSchemaFilenameFilter;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
@@ -47,7 +47,7 @@ import org.w3c.dom.Document;
|
||||
* Encapsulates the Item in the context of the DSpace Archive Format
|
||||
*/
|
||||
public class ItemArchive {
|
||||
private static final Logger log = Logger.getLogger(ItemArchive.class);
|
||||
private static final Logger log = org.apache.logging.log4j.LogManager.getLogger(ItemArchive.class);
|
||||
|
||||
public static final String DUBLIN_CORE_XML = "dublin_core.xml";
|
||||
|
||||
|
@@ -28,12 +28,13 @@ import javax.xml.transform.TransformerException;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.xpath.XPathAPI;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.content.MetadataField;
|
||||
import org.dspace.content.MetadataSchema;
|
||||
import org.dspace.content.MetadataSchemaEnum;
|
||||
import org.dspace.content.MetadataValue;
|
||||
import org.dspace.content.factory.ContentServiceFactory;
|
||||
import org.dspace.content.service.ItemService;
|
||||
@@ -189,7 +190,7 @@ public class MetadataUtilities {
|
||||
NodeList metadata = XPathAPI.selectNodeList(document, "/dublin_core");
|
||||
Node schemaAttr = metadata.item(0).getAttributes().getNamedItem("schema");
|
||||
if (schemaAttr == null) {
|
||||
schema = MetadataSchema.DC_SCHEMA;
|
||||
schema = MetadataSchemaEnum.DC.getName();
|
||||
} else {
|
||||
schema = schemaAttr.getNodeValue();
|
||||
}
|
||||
|
@@ -11,7 +11,7 @@ import java.io.InputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.poi.POITextExtractor;
|
||||
import org.apache.poi.extractor.ExtractorFactory;
|
||||
import org.apache.poi.hssf.extractor.ExcelExtractor;
|
||||
@@ -36,7 +36,7 @@ import org.dspace.content.Item;
|
||||
*/
|
||||
public class ExcelFilter extends MediaFilter {
|
||||
|
||||
private static Logger log = Logger.getLogger(ExcelFilter.class);
|
||||
private static Logger log = org.apache.logging.log4j.LogManager.getLogger(ExcelFilter.class);
|
||||
|
||||
public String getFilteredName(String oldFilename) {
|
||||
return oldFilename + ".txt";
|
||||
|
@@ -22,7 +22,7 @@ import org.apache.commons.cli.Option;
|
||||
import org.apache.commons.cli.OptionBuilder;
|
||||
import org.apache.commons.cli.Options;
|
||||
import org.apache.commons.cli.PosixParser;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.dspace.app.mediafilter.factory.MediaFilterServiceFactory;
|
||||
import org.dspace.app.mediafilter.service.MediaFilterService;
|
||||
import org.dspace.content.Collection;
|
||||
|
@@ -16,7 +16,7 @@ import java.io.InputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.Writer;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.pdfbox.pdmodel.PDDocument;
|
||||
import org.apache.pdfbox.text.PDFTextStripper;
|
||||
import org.dspace.content.Item;
|
||||
@@ -30,7 +30,7 @@ import org.dspace.core.ConfigurationManager;
|
||||
*/
|
||||
public class PDFFilter extends MediaFilter {
|
||||
|
||||
private static Logger log = Logger.getLogger(PDFFilter.class);
|
||||
private static Logger log = org.apache.logging.log4j.LogManager.getLogger(PDFFilter.class);
|
||||
|
||||
@Override
|
||||
public String getFilteredName(String oldFilename) {
|
||||
|
@@ -10,7 +10,7 @@ package org.dspace.app.mediafilter;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.InputStream;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.poi.POITextExtractor;
|
||||
import org.apache.poi.extractor.ExtractorFactory;
|
||||
import org.apache.poi.hslf.extractor.PowerPointExtractor;
|
||||
@@ -23,7 +23,7 @@ import org.dspace.content.Item;
|
||||
*/
|
||||
public class PowerPointFilter extends MediaFilter {
|
||||
|
||||
private static Logger log = Logger.getLogger(PowerPointFilter.class);
|
||||
private static Logger log = org.apache.logging.log4j.LogManager.getLogger(PowerPointFilter.class);
|
||||
|
||||
@Override
|
||||
public String getFilteredName(String oldFilename) {
|
||||
|
@@ -1,93 +0,0 @@
|
||||
/**
|
||||
* The contents of this file are subject to the license and copyright
|
||||
* detailed in the LICENSE and NOTICE files at the root of the source
|
||||
* tree and available online at
|
||||
*
|
||||
* http://www.dspace.org/license/
|
||||
*/
|
||||
package org.dspace.app.mediafilter;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.dspace.content.Item;
|
||||
import org.textmining.extraction.TextExtractor;
|
||||
import org.textmining.extraction.word.WordTextExtractorFactory;
|
||||
|
||||
/*
|
||||
*
|
||||
* to do: helpful error messages - can't find mediafilter.cfg - can't
|
||||
* instantiate filter - bitstream format doesn't exist.
|
||||
*
|
||||
*/
|
||||
public class WordFilter extends MediaFilter {
|
||||
|
||||
private static Logger log = Logger.getLogger(WordFilter.class);
|
||||
|
||||
@Override
|
||||
public String getFilteredName(String oldFilename) {
|
||||
return oldFilename + ".txt";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return String bundle name
|
||||
*/
|
||||
@Override
|
||||
public String getBundleName() {
|
||||
return "TEXT";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return String bitstreamformat
|
||||
*/
|
||||
@Override
|
||||
public String getFormatString() {
|
||||
return "Text";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return String description
|
||||
*/
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Extracted text";
|
||||
}
|
||||
|
||||
/**
|
||||
* @param currentItem item
|
||||
* @param source source input stream
|
||||
* @param verbose verbose mode
|
||||
* @return InputStream the resulting input stream
|
||||
* @throws Exception if error
|
||||
*/
|
||||
@Override
|
||||
public InputStream getDestinationStream(Item currentItem, InputStream source, boolean verbose)
|
||||
throws Exception {
|
||||
// get input stream from bitstream
|
||||
// pass to filter, get string back
|
||||
try {
|
||||
WordTextExtractorFactory factory = new WordTextExtractorFactory();
|
||||
TextExtractor e = factory.textExtractor(source);
|
||||
String extractedText = e.getText();
|
||||
|
||||
// if verbose flag is set, print out extracted text
|
||||
// to STDOUT
|
||||
if (verbose) {
|
||||
System.out.println(extractedText);
|
||||
}
|
||||
|
||||
// generate an input stream with the extracted text
|
||||
byte[] textBytes = extractedText.getBytes();
|
||||
ByteArrayInputStream bais = new ByteArrayInputStream(textBytes);
|
||||
|
||||
return bais; // will this work? or will the byte array be out of scope?
|
||||
} catch (IOException ioe) {
|
||||
System.out.println("Invalid Word Format");
|
||||
log.error("Error detected - Word File format not recognized: "
|
||||
+ ioe.getMessage(), ioe);
|
||||
throw ioe;
|
||||
}
|
||||
}
|
||||
}
|
@@ -9,8 +9,8 @@ package org.dspace.app.requestitem;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.core.ConfigurationManager;
|
||||
import org.dspace.core.Context;
|
||||
@@ -31,7 +31,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
*/
|
||||
public class RequestItemHelpdeskStrategy extends RequestItemSubmitterStrategy {
|
||||
|
||||
private Logger log = Logger.getLogger(RequestItemHelpdeskStrategy.class);
|
||||
private Logger log = org.apache.logging.log4j.LogManager.getLogger(RequestItemHelpdeskStrategy.class);
|
||||
|
||||
@Autowired(required = true)
|
||||
protected EPersonService ePersonService;
|
||||
|
@@ -10,7 +10,7 @@ package org.dspace.app.requestitem;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.content.MetadataValue;
|
||||
import org.dspace.content.service.ItemService;
|
||||
|
@@ -10,7 +10,7 @@ package org.dspace.app.requestitem;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.app.requestitem.dao.RequestItemDAO;
|
||||
import org.dspace.app.requestitem.service.RequestItemService;
|
||||
import org.dspace.content.Bitstream;
|
||||
@@ -28,7 +28,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
*/
|
||||
public class RequestItemServiceImpl implements RequestItemService {
|
||||
|
||||
private final Logger log = Logger.getLogger(RequestItemServiceImpl.class);
|
||||
private final Logger log = org.apache.logging.log4j.LogManager.getLogger(RequestItemServiceImpl.class);
|
||||
|
||||
@Autowired(required = true)
|
||||
protected RequestItemDAO requestItemDAO;
|
||||
|
@@ -15,8 +15,8 @@ import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.app.sfx.service.SFXFileReaderService;
|
||||
import org.dspace.content.DCPersonName;
|
||||
import org.dspace.content.Item;
|
||||
@@ -58,7 +58,7 @@ public class SFXFileReaderServiceImpl implements SFXFileReaderService {
|
||||
/**
|
||||
* log4j logger
|
||||
*/
|
||||
private final Logger log = Logger.getLogger(SFXFileReaderServiceImpl.class);
|
||||
private final Logger log = org.apache.logging.log4j.LogManager.getLogger(SFXFileReaderServiceImpl.class);
|
||||
|
||||
protected SFXFileReaderServiceImpl() {
|
||||
}
|
||||
|
@@ -13,7 +13,7 @@ import java.util.List;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.dspace.app.util.XMLUtils;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
package org.dspace.app.sherpa;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.HttpStatus;
|
||||
@@ -16,7 +16,7 @@ import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.utils.URIBuilder;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClientBuilder;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.core.ConfigurationManager;
|
||||
|
||||
public class SHERPAService {
|
||||
@@ -29,7 +29,7 @@ public class SHERPAService {
|
||||
/**
|
||||
* log4j category
|
||||
*/
|
||||
private static final Logger log = Logger.getLogger(SHERPAService.class);
|
||||
private static final Logger log = org.apache.logging.log4j.LogManager.getLogger(SHERPAService.class);
|
||||
|
||||
public SHERPAService() {
|
||||
HttpClientBuilder builder = HttpClientBuilder.create();
|
||||
|
@@ -11,8 +11,8 @@ import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.app.sherpa.SHERPAResponse;
|
||||
import org.dspace.app.sherpa.SHERPAService;
|
||||
import org.dspace.content.Item;
|
||||
@@ -27,7 +27,7 @@ public class SHERPASubmitService {
|
||||
/**
|
||||
* log4j logger
|
||||
*/
|
||||
private static Logger log = Logger.getLogger(SHERPASubmitService.class);
|
||||
private static Logger log = org.apache.logging.log4j.LogManager.getLogger(SHERPASubmitService.class);
|
||||
|
||||
public void setConfiguration(SHERPASubmitConfigurationService configuration) {
|
||||
this.configuration = configuration;
|
||||
|
@@ -27,9 +27,9 @@ import org.apache.commons.cli.HelpFormatter;
|
||||
import org.apache.commons.cli.Options;
|
||||
import org.apache.commons.cli.ParseException;
|
||||
import org.apache.commons.cli.PosixParser;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.content.Community;
|
||||
import org.dspace.content.Item;
|
||||
@@ -52,7 +52,7 @@ public class GenerateSitemaps {
|
||||
/**
|
||||
* Logger
|
||||
*/
|
||||
private static Logger log = Logger.getLogger(GenerateSitemaps.class);
|
||||
private static Logger log = org.apache.logging.log4j.LogManager.getLogger(GenerateSitemaps.class);
|
||||
|
||||
private static final CommunityService communityService = ContentServiceFactory.getInstance().getCommunityService();
|
||||
private static final CollectionService collectionService =
|
||||
|
@@ -28,7 +28,7 @@ import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.content.MetadataSchema;
|
||||
import org.dspace.content.MetadataSchemaEnum;
|
||||
import org.dspace.content.MetadataValue;
|
||||
import org.dspace.content.factory.ContentServiceFactory;
|
||||
import org.dspace.content.service.ItemService;
|
||||
@@ -763,9 +763,10 @@ public class ReportGenerator {
|
||||
// build the referece
|
||||
// FIXME: here we have blurred the line between content and presentation
|
||||
// and it should probably be un-blurred
|
||||
List<MetadataValue> title = itemService.getMetadata(item, MetadataSchema.DC_SCHEMA, "title", null, Item.ANY);
|
||||
List<MetadataValue> title = itemService.getMetadata(item, MetadataSchemaEnum.DC.getName(),
|
||||
"title", null, Item.ANY);
|
||||
List<MetadataValue> author = itemService
|
||||
.getMetadata(item, MetadataSchema.DC_SCHEMA, "contributor", "author", Item.ANY);
|
||||
.getMetadata(item, MetadataSchemaEnum.DC.getName(), "contributor", "author", Item.ANY);
|
||||
|
||||
StringBuffer authors = new StringBuffer();
|
||||
if (author.size() > 0) {
|
||||
|
@@ -21,7 +21,7 @@ import java.util.Set;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.commons.lang.time.DateUtils;
|
||||
import org.apache.commons.lang3.time.DateUtils;
|
||||
import org.dspace.core.ConfigurationManager;
|
||||
|
||||
/**
|
||||
|
@@ -13,8 +13,8 @@ import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.regex.PatternSyntaxException;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.dspace.content.MetadataSchema;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.dspace.content.MetadataSchemaEnum;
|
||||
import org.dspace.core.Utils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -160,7 +160,7 @@ public class DCInput {
|
||||
// Default the schema to dublin core
|
||||
dcSchema = fieldMap.get("dc-schema");
|
||||
if (dcSchema == null) {
|
||||
dcSchema = MetadataSchema.DC_SCHEMA;
|
||||
dcSchema = MetadataSchemaEnum.DC.getName();
|
||||
}
|
||||
|
||||
//check if the input have a language tag
|
||||
|
@@ -21,7 +21,7 @@ import javax.xml.parsers.FactoryConfigurationError;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.content.MetadataSchema;
|
||||
import org.dspace.content.MetadataSchemaEnum;
|
||||
import org.dspace.core.Utils;
|
||||
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||
import org.w3c.dom.Document;
|
||||
@@ -464,7 +464,7 @@ public class DCInputsReader {
|
||||
String elem = field.get("dc-element");
|
||||
String qual = field.get("dc-qualifier");
|
||||
if ((schema == null) || (schema.equals(""))) {
|
||||
schema = MetadataSchema.DC_SCHEMA;
|
||||
schema = MetadataSchemaEnum.DC.getName();
|
||||
}
|
||||
String schemaTest;
|
||||
|
||||
@@ -474,7 +474,7 @@ public class DCInputsReader {
|
||||
Map<String, String> fld = pg.get(j);
|
||||
if ((fld.get("dc-schema") == null) ||
|
||||
((fld.get("dc-schema")).equals(""))) {
|
||||
schemaTest = MetadataSchema.DC_SCHEMA;
|
||||
schemaTest = MetadataSchemaEnum.DC.getName();
|
||||
} else {
|
||||
schemaTest = fld.get("dc-schema");
|
||||
}
|
||||
|
@@ -16,14 +16,14 @@ import java.util.Enumeration;
|
||||
import javax.servlet.ServletContextEvent;
|
||||
import javax.servlet.ServletContextListener;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Class to initialize / cleanup resources used by DSpace when the web application
|
||||
* is started or stopped.
|
||||
*/
|
||||
public class DSpaceContextListener implements ServletContextListener {
|
||||
private static Logger log = Logger.getLogger(DSpaceContextListener.class);
|
||||
private static Logger log = org.apache.logging.log4j.LogManager.getLogger(DSpaceContextListener.class);
|
||||
|
||||
/**
|
||||
* Initialize any resources required by the application.
|
||||
|
@@ -1,299 +0,0 @@
|
||||
/**
|
||||
* The contents of this file are subject to the license and copyright
|
||||
* detailed in the LICENSE and NOTICE files at the root of the source
|
||||
* tree and available online at
|
||||
*
|
||||
* http://www.dspace.org/license/
|
||||
*/
|
||||
package org.dspace.app.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.UnknownHostException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.commons.lang.time.DateUtils;
|
||||
import org.apache.log4j.FileAppender;
|
||||
import org.apache.log4j.helpers.LogLog;
|
||||
import org.apache.log4j.spi.LoggingEvent;
|
||||
|
||||
/**
|
||||
* Special log appender for log4j. Adds the current date (ie. year-mon) to
|
||||
* the end of the file name, so that rolling on to the next log is simply
|
||||
* a case of starting a new one - no renaming of old logs.
|
||||
*
|
||||
* This is advisable if you are using Windows, and have multiple applications
|
||||
* (ie. dspace, dspace-oai, dspace-sword) that all want to write to the same log file,
|
||||
* as each would otherwise try to rename the old files during rollover.
|
||||
*
|
||||
* An example log4j.properties (one log per month, retains three months of logs)
|
||||
*
|
||||
* log4j.rootCategory=INFO, A1
|
||||
* log4j.appender.A1=org.dspace.app.util.DailyFileAppender
|
||||
* log4j.appender.A1.File=@@log.dir@@/dspace.log
|
||||
* log4j.appender.A1.DatePattern=yyyy-MM
|
||||
* log4j.appender.A1.MaxLogs=3
|
||||
* log4j.appender.A1.layout=org.apache.log4j.PatternLayout
|
||||
* log4j.appender.A1.layout.ConversionPattern=%d %-5p %c @ %m%n
|
||||
*/
|
||||
public class DailyFileAppender extends FileAppender {
|
||||
/**
|
||||
* The fixed date pattern to be used if one is not specified.
|
||||
*/
|
||||
private static final String DATE_PATTERN = "yyyy-MM-dd";
|
||||
|
||||
/**
|
||||
* The folder under which daily folders are created. This can be a absolute path
|
||||
* or relative path also.
|
||||
* e.g. JavaLogs/CPRILog or F:/LogFiles/CPRILog
|
||||
*/
|
||||
private String mstrFileName;
|
||||
|
||||
/**
|
||||
* Used internally and contains the name of the date derived from current system date.
|
||||
*/
|
||||
private Date mstrDate = new Date(System.currentTimeMillis());
|
||||
|
||||
/**
|
||||
* Holds the user specified DatePattern,
|
||||
*/
|
||||
private String mstrDatePattern = DATE_PATTERN;
|
||||
|
||||
private boolean mMonthOnly = false;
|
||||
|
||||
/**
|
||||
* The date formatter object used for parsing the user specified DatePattern.
|
||||
*/
|
||||
private SimpleDateFormat mobjSDF;
|
||||
|
||||
private boolean mWithHostName = false;
|
||||
|
||||
private int mMaxLogs = 0;
|
||||
|
||||
/**
|
||||
* Default constructor. This is required as the appender class is dynamically
|
||||
* loaded.
|
||||
*/
|
||||
public DailyFileAppender() {
|
||||
super();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.apache.log4j.FileAppender#activateOptions()
|
||||
*/
|
||||
@Override
|
||||
public void activateOptions() {
|
||||
setFileName();
|
||||
cleanupOldFiles();
|
||||
super.activateOptions();
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Getters
|
||||
*----------------------------------------------------------------------------*/
|
||||
public String getDatePattern() {
|
||||
return this.mstrDatePattern;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFile() {
|
||||
return this.mstrFileName;
|
||||
}
|
||||
|
||||
public boolean getWithHost() {
|
||||
return mWithHostName;
|
||||
}
|
||||
|
||||
public int getMaxLogs() {
|
||||
return mMaxLogs;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Setters
|
||||
*----------------------------------------------------------------------------*/
|
||||
public void setDatePattern(String pstrPattern) {
|
||||
this.mstrDatePattern = checkPattern(pstrPattern);
|
||||
if (mstrDatePattern.contains("dd") || mstrDatePattern.contains("DD")) {
|
||||
mMonthOnly = false;
|
||||
} else {
|
||||
mMonthOnly = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFile(String file) {
|
||||
// Trim spaces from both ends. The users probably does not want
|
||||
// trailing spaces in file names.
|
||||
String val = file.trim();
|
||||
mstrFileName = val;
|
||||
}
|
||||
|
||||
public void setWithHost(boolean wh) {
|
||||
mWithHostName = wh;
|
||||
}
|
||||
|
||||
public void setMaxLogs(int ml) {
|
||||
mMaxLogs = ml;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Methods
|
||||
*----------------------------------------------------------------------------*/
|
||||
/* (non-Javadoc)
|
||||
* @see org.apache.log4j.WriterAppender#subAppend(org.apache.log4j.spi.LoggingEvent)
|
||||
*/
|
||||
@Override
|
||||
protected void subAppend(LoggingEvent pobjEvent) {
|
||||
Date dtNow = new Date(System.currentTimeMillis());
|
||||
|
||||
boolean rollover = false;
|
||||
|
||||
if (mMonthOnly) {
|
||||
Calendar now = Calendar.getInstance();
|
||||
Calendar cur = Calendar.getInstance();
|
||||
now.setTime(dtNow);
|
||||
cur.setTime(mstrDate);
|
||||
rollover = !(now.get(Calendar.YEAR) == cur.get(Calendar.YEAR) && now.get(Calendar.MONTH) == cur
|
||||
.get(Calendar.MONTH));
|
||||
} else {
|
||||
rollover = !(DateUtils.isSameDay(dtNow, mstrDate));
|
||||
}
|
||||
|
||||
if (rollover) {
|
||||
try {
|
||||
rollOver(dtNow);
|
||||
} catch (IOException IOEx) {
|
||||
LogLog.error("rollOver() failed!", IOEx);
|
||||
}
|
||||
}
|
||||
|
||||
super.subAppend(pobjEvent);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Helpers
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* The helper function to validate the DatePattern.
|
||||
*
|
||||
* @param pstrPattern The DatePattern to be validated.
|
||||
* @return The validated date pattern or defautlt DATE_PATTERN
|
||||
*/
|
||||
private String checkPattern(String pstrPattern) {
|
||||
String strRet = null;
|
||||
SimpleDateFormat objFmt = new SimpleDateFormat(DATE_PATTERN);
|
||||
|
||||
try {
|
||||
this.mobjSDF = new SimpleDateFormat(pstrPattern);
|
||||
strRet = pstrPattern;
|
||||
} catch (NullPointerException NPExIgnore) {
|
||||
LogLog.error("Invalid DatePattern " + pstrPattern, NPExIgnore);
|
||||
this.mobjSDF = objFmt;
|
||||
strRet = DATE_PATTERN;
|
||||
} catch (IllegalArgumentException IlArgExIgnore) {
|
||||
LogLog.error("Invalid DatePattern " + pstrPattern, IlArgExIgnore);
|
||||
this.mobjSDF = objFmt;
|
||||
strRet = DATE_PATTERN;
|
||||
} finally {
|
||||
objFmt = null;
|
||||
}
|
||||
return strRet;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is responsible for performing the actual file rollover.
|
||||
*
|
||||
* @param pstrName The name of the new folder based on current system date.
|
||||
* @throws IOException if IO error
|
||||
*/
|
||||
private static boolean deletingFiles = false;
|
||||
|
||||
private void cleanupOldFiles() {
|
||||
// If we need to delete log files
|
||||
if (mMaxLogs > 0 && !deletingFiles) {
|
||||
deletingFiles = true;
|
||||
|
||||
// Determine the final file extension with the hostname
|
||||
String hostFileExt = null;
|
||||
try {
|
||||
hostFileExt = "." + java.net.InetAddress.getLocalHost().getHostName();
|
||||
} catch (UnknownHostException e) {
|
||||
LogLog.error("Unable to retrieve host name");
|
||||
}
|
||||
|
||||
try {
|
||||
// Array to hold the logs we are going to keep
|
||||
File[] logsToKeep = new File[mMaxLogs];
|
||||
|
||||
// Get a 'master' file handle, and the parent directory from it
|
||||
File logMaster = new File(mstrFileName);
|
||||
File logDir = logMaster.getParentFile();
|
||||
if (logDir.isDirectory()) {
|
||||
// Iterate all the files in that directory
|
||||
File[] logArr = logDir.listFiles();
|
||||
for (File curLog : logArr) {
|
||||
LogLog.debug("Comparing '" + curLog.getAbsolutePath() + "' to '" + mstrFileName + "'");
|
||||
String name = curLog.getAbsolutePath();
|
||||
|
||||
// First, see if we are not using hostname, or the log file ends with this host
|
||||
if (!mWithHostName || (hostFileExt != null && name.endsWith(hostFileExt))) {
|
||||
// Check that the file is indeed one we want (contains the master file name)
|
||||
if (name.contains(mstrFileName)) {
|
||||
// Iterate through the array of logs we are keeping
|
||||
for (int i = 0; curLog != null && i < logsToKeep.length; i++) {
|
||||
// Have we exhausted the 'to keep' array?
|
||||
if (logsToKeep[i] == null) {
|
||||
// Empty space, retain this log file
|
||||
logsToKeep[i] = curLog;
|
||||
curLog = null;
|
||||
} else if (logsToKeep[i].getName().compareTo(curLog.getName()) < 0) {
|
||||
// If the 'kept' file is older than the current one
|
||||
// Replace tested entry with current file
|
||||
File temp = logsToKeep[i];
|
||||
logsToKeep[i] = curLog;
|
||||
curLog = temp;
|
||||
}
|
||||
}
|
||||
|
||||
// If we have a 'current' entry at this point, it's a log we don't want
|
||||
if (curLog != null) {
|
||||
LogLog.debug("Deleting log " + curLog.getName());
|
||||
if (!curLog.delete()) {
|
||||
LogLog.error("Unable to delete log file");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// Don't worry about exceptions
|
||||
} finally {
|
||||
deletingFiles = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void rollOver(Date dtNow) throws IOException {
|
||||
mstrDate = dtNow;
|
||||
setFileName();
|
||||
this.setFile(fileName, true, bufferedIO, bufferSize);
|
||||
|
||||
cleanupOldFiles();
|
||||
}
|
||||
|
||||
private void setFileName() {
|
||||
fileName = mstrFileName + "." + mobjSDF.format(mstrDate);
|
||||
|
||||
if (mWithHostName) {
|
||||
try {
|
||||
fileName += "." + java.net.InetAddress.getLocalHost().getHostName();
|
||||
} catch (UnknownHostException e) {
|
||||
LogLog.error("Unable to retrieve host name");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -12,7 +12,7 @@ import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.content.Bitstream;
|
||||
import org.dspace.content.BitstreamFormat;
|
||||
import org.dspace.content.factory.ContentServiceFactory;
|
||||
@@ -24,7 +24,7 @@ import org.dspace.core.Context;
|
||||
*/
|
||||
public class GoogleBitstreamComparator implements Comparator<Bitstream> {
|
||||
|
||||
private final static Logger log = Logger.getLogger(GoogleBitstreamComparator.class);
|
||||
private final static Logger log = org.apache.logging.log4j.LogManager.getLogger(GoogleBitstreamComparator.class);
|
||||
|
||||
HashMap<String, Integer> priorityMap = new HashMap<>();
|
||||
|
||||
|
@@ -26,7 +26,7 @@ import java.util.Properties;
|
||||
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import com.google.common.collect.ListMultimap;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.authorize.factory.AuthorizeServiceFactory;
|
||||
import org.dspace.content.Bitstream;
|
||||
import org.dspace.content.Bundle;
|
||||
@@ -51,7 +51,7 @@ import org.jdom.Element;
|
||||
@SuppressWarnings("deprecation")
|
||||
public class GoogleMetadata {
|
||||
|
||||
private final static Logger log = Logger.getLogger(GoogleMetadata.class);
|
||||
private final static Logger log = org.apache.logging.log4j.LogManager.getLogger(GoogleMetadata.class);
|
||||
|
||||
protected static final String GOOGLE_PREFIX = "google.";
|
||||
|
||||
|
@@ -22,8 +22,9 @@ import org.apache.commons.cli.HelpFormatter;
|
||||
import org.apache.commons.cli.Options;
|
||||
import org.apache.commons.cli.ParseException;
|
||||
import org.apache.commons.cli.PosixParser;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.content.EntityType;
|
||||
import org.dspace.content.RelationshipType;
|
||||
@@ -45,7 +46,7 @@ import org.xml.sax.SAXException;
|
||||
*/
|
||||
public class InitializeEntities {
|
||||
|
||||
private final static Logger log = Logger.getLogger(InitializeEntities.class);
|
||||
private final static Logger log = LogManager.getLogger();
|
||||
|
||||
private RelationshipTypeService relationshipTypeService;
|
||||
private RelationshipService relationshipService;
|
||||
|
@@ -14,7 +14,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.app.util.service.MetadataExposureService;
|
||||
import org.dspace.authorize.service.AuthorizeService;
|
||||
import org.dspace.core.Context;
|
||||
@@ -58,7 +58,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
* @version $Revision: 3734 $
|
||||
*/
|
||||
public class MetadataExposureServiceImpl implements MetadataExposureService {
|
||||
protected Logger log = Logger.getLogger(MetadataExposureServiceImpl.class);
|
||||
protected Logger log = org.apache.logging.log4j.LogManager.getLogger(MetadataExposureServiceImpl.class);
|
||||
|
||||
protected Map<String, Set<String>> hiddenElementSets = null;
|
||||
protected Map<String, Map<String, Set<String>>> hiddenElementMaps = null;
|
||||
|
@@ -20,7 +20,7 @@ import com.sun.syndication.feed.module.opensearch.OpenSearchModule;
|
||||
import com.sun.syndication.feed.module.opensearch.entity.OSQuery;
|
||||
import com.sun.syndication.feed.module.opensearch.impl.OpenSearchModuleImpl;
|
||||
import com.sun.syndication.io.FeedException;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.app.util.service.OpenSearchService;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.core.Constants;
|
||||
@@ -54,7 +54,7 @@ import org.w3c.dom.Document;
|
||||
* @author Richard Rodgers
|
||||
*/
|
||||
public class OpenSearchServiceImpl implements OpenSearchService, InitializingBean {
|
||||
private static final Logger log = Logger.getLogger(OpenSearchServiceImpl.class);
|
||||
private static final Logger log = org.apache.logging.log4j.LogManager.getLogger(OpenSearchServiceImpl.class);
|
||||
|
||||
// are open search queries enabled?
|
||||
protected boolean enabled = false;
|
||||
|
@@ -11,7 +11,7 @@ import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.content.factory.ContentServiceFactory;
|
||||
import org.dspace.content.service.CollectionService;
|
||||
@@ -28,7 +28,7 @@ import org.springframework.util.StopWatch;
|
||||
* Invocation: dsrun org.dspace.app.util.OptimizeSelectCollection
|
||||
*/
|
||||
public class OptimizeSelectCollection {
|
||||
private static final Logger log = Logger.getLogger(OptimizeSelectCollection.class);
|
||||
private static final Logger log = org.apache.logging.log4j.LogManager.getLogger(OptimizeSelectCollection.class);
|
||||
private static Context context;
|
||||
|
||||
private static ArrayList<EPerson> brokenPeople;
|
||||
|
@@ -12,7 +12,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Class representing a single Item Submission config definition, organized into
|
||||
@@ -44,7 +44,7 @@ public class SubmissionConfig implements Serializable {
|
||||
/**
|
||||
* log4j logger
|
||||
*/
|
||||
private static Logger log = Logger.getLogger(SubmissionConfig.class);
|
||||
private static Logger log = org.apache.logging.log4j.LogManager.getLogger(SubmissionConfig.class);
|
||||
|
||||
/**
|
||||
* Constructs a new Submission Configuration object, based on the XML
|
||||
|
@@ -19,7 +19,7 @@ import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.FactoryConfigurationError;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.core.Context;
|
||||
@@ -71,7 +71,7 @@ public class SubmissionConfigReader {
|
||||
/**
|
||||
* log4j logger
|
||||
*/
|
||||
private static Logger log = Logger.getLogger(SubmissionConfigReader.class);
|
||||
private static Logger log = org.apache.logging.log4j.LogManager.getLogger(SubmissionConfigReader.class);
|
||||
|
||||
/**
|
||||
* The fully qualified pathname of the directory containing the Item Submission Configuration file
|
||||
|
@@ -34,9 +34,9 @@ import com.sun.syndication.feed.synd.SyndPerson;
|
||||
import com.sun.syndication.feed.synd.SyndPersonImpl;
|
||||
import com.sun.syndication.io.FeedException;
|
||||
import com.sun.syndication.io.SyndFeedOutput;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.content.Bitstream;
|
||||
import org.dspace.content.Bundle;
|
||||
import org.dspace.content.Collection;
|
||||
@@ -69,7 +69,7 @@ import org.w3c.dom.Document;
|
||||
* @author Larry Stone
|
||||
*/
|
||||
public class SyndicationFeed {
|
||||
protected final Logger log = Logger.getLogger(SyndicationFeed.class);
|
||||
protected final Logger log = org.apache.logging.log4j.LogManager.getLogger(SyndicationFeed.class);
|
||||
|
||||
|
||||
/**
|
||||
|
@@ -23,8 +23,8 @@ import java.util.UUID;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.content.MetadataValue;
|
||||
@@ -44,7 +44,7 @@ public class Util {
|
||||
// cache for source version result
|
||||
private static String sourceVersion = null;
|
||||
|
||||
private static Logger log = Logger.getLogger(Util.class);
|
||||
private static Logger log = org.apache.logging.log4j.LogManager.getLogger(Util.class);
|
||||
|
||||
/**
|
||||
* Default constructor. Must be protected as org.dspace.xmlworkflow.WorkflowUtils extends it
|
||||
|
@@ -18,7 +18,7 @@ import org.apache.http.HttpStatus;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.client.methods.HttpHead;
|
||||
import org.apache.http.impl.client.DefaultHttpClient;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.app.util.dao.WebAppDAO;
|
||||
import org.dspace.app.util.service.WebAppService;
|
||||
import org.dspace.core.Context;
|
||||
@@ -33,7 +33,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
*/
|
||||
public class WebAppServiceImpl implements WebAppService {
|
||||
|
||||
private final Logger log = Logger.getLogger(WebAppServiceImpl.class);
|
||||
private final Logger log = org.apache.logging.log4j.LogManager.getLogger(WebAppServiceImpl.class);
|
||||
|
||||
@Autowired(required = true)
|
||||
protected WebAppDAO webAppDAO;
|
||||
|
@@ -11,7 +11,7 @@ import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
|
@@ -17,14 +17,15 @@ import java.util.UUID;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.dspace.core.ConfigurationManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.LogManager;
|
||||
import org.dspace.core.factory.CoreServiceFactory;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.eperson.Group;
|
||||
import org.dspace.eperson.factory.EPersonServiceFactory;
|
||||
import org.dspace.eperson.service.GroupService;
|
||||
import org.dspace.service.ClientInfoService;
|
||||
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||
|
||||
/**
|
||||
@@ -49,7 +50,7 @@ public class IPAuthentication implements AuthenticationMethod {
|
||||
/**
|
||||
* Our logger
|
||||
*/
|
||||
private static Logger log = Logger.getLogger(IPAuthentication.class);
|
||||
private static Logger log = org.apache.logging.log4j.LogManager.getLogger(IPAuthentication.class);
|
||||
|
||||
/**
|
||||
* Whether to look for x-forwarded headers for logging IP addresses
|
||||
@@ -67,6 +68,7 @@ public class IPAuthentication implements AuthenticationMethod {
|
||||
protected List<IPMatcher> ipNegativeMatchers;
|
||||
|
||||
protected GroupService groupService;
|
||||
protected ClientInfoService clientInfoService;
|
||||
|
||||
|
||||
/**
|
||||
@@ -91,6 +93,7 @@ public class IPAuthentication implements AuthenticationMethod {
|
||||
ipMatcherGroupIDs = new HashMap<>();
|
||||
ipMatcherGroupNames = new HashMap<>();
|
||||
groupService = EPersonServiceFactory.getInstance().getGroupService();
|
||||
clientInfoService = CoreServiceFactory.getInstance().getClientInfoService();
|
||||
|
||||
List<String> propNames = DSpaceServicesFactory.getInstance().getConfigurationService()
|
||||
.getPropertyKeys("authentication-ip");
|
||||
@@ -169,18 +172,7 @@ public class IPAuthentication implements AuthenticationMethod {
|
||||
List<Group> groups = new ArrayList<Group>();
|
||||
|
||||
// Get the user's IP address
|
||||
String addr = request.getRemoteAddr();
|
||||
if (useProxies == null) {
|
||||
useProxies = ConfigurationManager.getBooleanProperty("useProxies", false);
|
||||
}
|
||||
if (useProxies && request.getHeader("X-Forwarded-For") != null) {
|
||||
/* This header is a comma delimited list */
|
||||
for (String xfip : request.getHeader("X-Forwarded-For").split(",")) {
|
||||
if (!request.getHeader("X-Forwarded-For").contains(addr)) {
|
||||
addr = xfip.trim();
|
||||
}
|
||||
}
|
||||
}
|
||||
String addr = clientInfoService.getClientIp(request);
|
||||
|
||||
for (IPMatcher ipm : ipMatchers) {
|
||||
try {
|
||||
|
@@ -10,7 +10,7 @@ package org.dspace.authenticate;
|
||||
import java.net.Inet6Address;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -38,7 +38,7 @@ import org.apache.log4j.Logger;
|
||||
* @version $Revision$
|
||||
*/
|
||||
public class IPMatcher {
|
||||
private static Logger log = Logger.getLogger(IPMatcher.class);
|
||||
private static Logger log = org.apache.logging.log4j.LogManager.getLogger(IPMatcher.class);
|
||||
|
||||
/**
|
||||
* Network to match
|
||||
|
@@ -28,8 +28,8 @@ import javax.naming.ldap.StartTlsResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.authenticate.factory.AuthenticateServiceFactory;
|
||||
import org.dspace.authenticate.service.AuthenticationService;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
@@ -61,7 +61,7 @@ public class LDAPAuthentication
|
||||
/**
|
||||
* log4j category
|
||||
*/
|
||||
private static Logger log = Logger.getLogger(LDAPAuthentication.class);
|
||||
private static Logger log = org.apache.logging.log4j.LogManager.getLogger(LDAPAuthentication.class);
|
||||
|
||||
protected AuthenticationService authenticationService = AuthenticateServiceFactory.getInstance()
|
||||
.getAuthenticationService();
|
||||
|
@@ -15,7 +15,7 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.LogManager;
|
||||
import org.dspace.eperson.EPerson;
|
||||
@@ -49,7 +49,7 @@ public class PasswordAuthentication
|
||||
/**
|
||||
* log4j category
|
||||
*/
|
||||
private static Logger log = Logger.getLogger(PasswordAuthentication.class);
|
||||
private static Logger log = org.apache.logging.log4j.LogManager.getLogger(PasswordAuthentication.class);
|
||||
|
||||
|
||||
/**
|
||||
|
@@ -23,8 +23,8 @@ import java.util.UUID;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.authenticate.factory.AuthenticateServiceFactory;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.content.MetadataField;
|
||||
@@ -70,7 +70,7 @@ public class ShibAuthentication implements AuthenticationMethod {
|
||||
/**
|
||||
* log4j category
|
||||
*/
|
||||
private static Logger log = Logger.getLogger(ShibAuthentication.class);
|
||||
private static Logger log = org.apache.logging.log4j.LogManager.getLogger(ShibAuthentication.class);
|
||||
|
||||
/**
|
||||
* Additional metadata mappings
|
||||
|
@@ -29,8 +29,8 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.authenticate.factory.AuthenticateServiceFactory;
|
||||
import org.dspace.authenticate.service.AuthenticationService;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
@@ -105,7 +105,7 @@ public class X509Authentication implements AuthenticationMethod {
|
||||
/**
|
||||
* log4j category
|
||||
*/
|
||||
private static Logger log = Logger.getLogger(X509Authentication.class);
|
||||
private static Logger log = org.apache.logging.log4j.LogManager.getLogger(X509Authentication.class);
|
||||
|
||||
/**
|
||||
* public key of CA to check client certs against.
|
||||
|
@@ -12,7 +12,7 @@ import java.net.MalformedURLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.solr.client.solrj.SolrQuery;
|
||||
import org.apache.solr.client.solrj.SolrServerException;
|
||||
import org.apache.solr.client.solrj.impl.HttpSolrServer;
|
||||
@@ -30,7 +30,7 @@ import org.dspace.core.ConfigurationManager;
|
||||
*/
|
||||
public class AuthoritySolrServiceImpl implements AuthorityIndexingService, AuthoritySearchService {
|
||||
|
||||
private static final Logger log = Logger.getLogger(AuthoritySolrServiceImpl.class);
|
||||
private static final Logger log = org.apache.logging.log4j.LogManager.getLogger(AuthoritySolrServiceImpl.class);
|
||||
|
||||
protected AuthoritySolrServiceImpl() {
|
||||
|
||||
|
@@ -12,7 +12,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
* This class contains a list of active authority types.
|
||||
@@ -32,7 +32,7 @@ public class AuthorityTypes {
|
||||
/**
|
||||
* log4j logger
|
||||
*/
|
||||
private static Logger log = Logger.getLogger(AuthorityTypes.class);
|
||||
private static Logger log = org.apache.logging.log4j.LogManager.getLogger(AuthorityTypes.class);
|
||||
|
||||
protected List<AuthorityValue> types = new ArrayList<AuthorityValue>();
|
||||
|
||||
|
@@ -14,8 +14,8 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.solr.common.SolrDocument;
|
||||
import org.apache.solr.common.SolrInputDocument;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
@@ -234,7 +234,7 @@ public class AuthorityValue {
|
||||
/**
|
||||
* log4j logger
|
||||
*/
|
||||
private static Logger log = Logger.getLogger(AuthorityValue.class);
|
||||
private static Logger log = org.apache.logging.log4j.LogManager.getLogger(AuthorityValue.class);
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
@@ -13,8 +13,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.solr.client.solrj.SolrQuery;
|
||||
import org.apache.solr.client.solrj.response.QueryResponse;
|
||||
import org.apache.solr.common.SolrDocument;
|
||||
@@ -34,7 +34,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
*/
|
||||
public class AuthorityValueServiceImpl implements AuthorityValueService {
|
||||
|
||||
private final Logger log = Logger.getLogger(AuthorityValueServiceImpl.class);
|
||||
private final Logger log = org.apache.logging.log4j.LogManager.getLogger(AuthorityValueServiceImpl.class);
|
||||
|
||||
@Autowired(required = true)
|
||||
protected AuthorityTypes authorityTypes;
|
||||
|
@@ -12,8 +12,8 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang.ObjectUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.solr.common.SolrDocument;
|
||||
import org.apache.solr.common.SolrInputDocument;
|
||||
|
||||
|
@@ -19,7 +19,7 @@ import org.apache.commons.cli.HelpFormatter;
|
||||
import org.apache.commons.cli.Options;
|
||||
import org.apache.commons.cli.ParseException;
|
||||
import org.apache.commons.cli.PosixParser;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.authority.factory.AuthorityServiceFactory;
|
||||
import org.dspace.authority.service.AuthorityValueService;
|
||||
import org.dspace.content.Item;
|
||||
@@ -40,7 +40,7 @@ public class UpdateAuthorities {
|
||||
/**
|
||||
* log4j logger
|
||||
*/
|
||||
private static Logger log = Logger.getLogger(UpdateAuthorities.class);
|
||||
private static Logger log = org.apache.logging.log4j.LogManager.getLogger(UpdateAuthorities.class);
|
||||
|
||||
protected PrintWriter print = null;
|
||||
|
||||
|
@@ -12,7 +12,7 @@ import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.authority.factory.AuthorityServiceFactory;
|
||||
import org.dspace.authority.service.AuthorityService;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
@@ -33,7 +33,7 @@ import org.dspace.event.Event;
|
||||
*/
|
||||
public class AuthorityConsumer implements Consumer {
|
||||
|
||||
private final Logger log = Logger.getLogger(AuthorityConsumer.class);
|
||||
private final Logger log = org.apache.logging.log4j.LogManager.getLogger(AuthorityConsumer.class);
|
||||
|
||||
/**
|
||||
* A set of all item IDs installed which need their authority updated
|
||||
|
@@ -12,7 +12,7 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.authority.AuthorityValue;
|
||||
import org.dspace.authority.factory.AuthorityServiceFactory;
|
||||
import org.dspace.authority.service.AuthorityService;
|
||||
@@ -29,7 +29,7 @@ import org.dspace.core.Context;
|
||||
*/
|
||||
public class AuthorityIndexClient {
|
||||
|
||||
private static Logger log = Logger.getLogger(AuthorityIndexClient.class);
|
||||
private static Logger log = org.apache.logging.log4j.LogManager.getLogger(AuthorityIndexClient.class);
|
||||
|
||||
protected static final AuthorityService authorityService =
|
||||
AuthorityServiceFactory.getInstance().getAuthorityService();
|
||||
|
@@ -13,8 +13,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.authority.AuthorityValue;
|
||||
import org.dspace.authority.service.AuthorityValueService;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
@@ -45,7 +45,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
*/
|
||||
public class DSpaceAuthorityIndexer implements AuthorityIndexerInterface, InitializingBean {
|
||||
|
||||
private static final Logger log = Logger.getLogger(DSpaceAuthorityIndexer.class);
|
||||
private static final Logger log = org.apache.logging.log4j.LogManager.getLogger(DSpaceAuthorityIndexer.class);
|
||||
|
||||
/**
|
||||
* The list of metadata fields which are to be indexed *
|
||||
|
@@ -15,12 +15,13 @@ import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.impl.client.HttpClientBuilder;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.authority.AuthorityValue;
|
||||
import org.dspace.authority.SolrAuthorityInterface;
|
||||
import org.dspace.authority.orcid.xml.XMLtoBio;
|
||||
@@ -35,7 +36,7 @@ import org.orcid.jaxb.model.record_v2.Person;
|
||||
*/
|
||||
public class Orcidv2 implements SolrAuthorityInterface {
|
||||
|
||||
private static Logger log = Logger.getLogger(Orcidv2.class);
|
||||
private static Logger log = LogManager.getLogger(Orcidv2.class);
|
||||
|
||||
public RESTConnector restConnector;
|
||||
private String OAUTHUrl;
|
||||
@@ -46,7 +47,9 @@ public class Orcidv2 implements SolrAuthorityInterface {
|
||||
private String accessToken;
|
||||
|
||||
/**
|
||||
* Initialize the accessToken that is required for all subsequent calls to ORCID
|
||||
* Initialize the accessToken that is required for all subsequent calls to ORCID.
|
||||
*
|
||||
* @throws java.io.IOException passed through from HTTPclient.
|
||||
*/
|
||||
public void init() throws IOException {
|
||||
if (StringUtils.isNotBlank(accessToken) && StringUtils.isNotBlank(clientSecret)) {
|
||||
|
@@ -15,7 +15,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.solr.common.SolrDocument;
|
||||
import org.apache.solr.common.SolrInputDocument;
|
||||
import org.dspace.authority.AuthorityValue;
|
||||
|
@@ -14,10 +14,9 @@ import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.JAXBException;
|
||||
import javax.xml.bind.Unmarshaller;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
|
||||
/**
|
||||
* @param <T> type
|
||||
* @author Antoine Snyers (antoine at atmire.com)
|
||||
@@ -30,7 +29,7 @@ public abstract class Converter<T> {
|
||||
/**
|
||||
* log4j logger
|
||||
*/
|
||||
private static Logger log = Logger.getLogger(Converter.class);
|
||||
private static Logger log = org.apache.logging.log4j.LogManager.getLogger(Converter.class);
|
||||
|
||||
public abstract T convert(InputStream document);
|
||||
|
||||
|
@@ -12,7 +12,7 @@ import java.net.URISyntaxException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.authority.orcid.Orcidv2;
|
||||
import org.dspace.utils.DSpace;
|
||||
import org.orcid.jaxb.model.common_v2.OrcidId;
|
||||
@@ -21,8 +21,6 @@ import org.orcid.jaxb.model.search_v2.Result;
|
||||
import org.orcid.jaxb.model.search_v2.Search;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author Antoine Snyers (antoine at atmire.com)
|
||||
* @author Kevin Van de Velde (kevin at atmire dot com)
|
||||
@@ -34,7 +32,7 @@ public class XMLtoBio extends Converter {
|
||||
/**
|
||||
* log4j logger
|
||||
*/
|
||||
private static Logger log = Logger.getLogger(XMLtoBio.class);
|
||||
private static Logger log = org.apache.logging.log4j.LogManager.getLogger(XMLtoBio.class);
|
||||
|
||||
@Override
|
||||
public List<Person> convert(InputStream xml) {
|
||||
|
@@ -15,7 +15,7 @@ import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.impl.client.HttpClientBuilder;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
* @author Antoine Snyers (antoine at atmire.com)
|
||||
@@ -28,7 +28,7 @@ public class RESTConnector {
|
||||
/**
|
||||
* log4j logger
|
||||
*/
|
||||
private static Logger log = Logger.getLogger(RESTConnector.class);
|
||||
private static Logger log = org.apache.logging.log4j.LogManager.getLogger(RESTConnector.class);
|
||||
|
||||
private String url;
|
||||
|
||||
|
@@ -7,8 +7,8 @@
|
||||
*/
|
||||
package org.dspace.authority.util;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
* @author Antoine Snyers (antoine at atmire.com)
|
||||
@@ -21,7 +21,7 @@ public class EnumUtils {
|
||||
/**
|
||||
* log4j logger
|
||||
*/
|
||||
private static Logger log = Logger.getLogger(EnumUtils.class);
|
||||
private static Logger log = org.apache.logging.log4j.LogManager.getLogger(EnumUtils.class);
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
|
@@ -17,7 +17,7 @@ import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.transform.TransformerException;
|
||||
import javax.xml.xpath.XPathExpressionException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.xpath.XPathAPI;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
@@ -36,7 +36,7 @@ public class XMLUtils {
|
||||
/**
|
||||
* log4j logger
|
||||
*/
|
||||
private static Logger log = Logger.getLogger(XMLUtils.class);
|
||||
private static Logger log = org.apache.logging.log4j.LogManager.getLogger(XMLUtils.class);
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
|
@@ -16,7 +16,7 @@ import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.dspace.authorize.service.AuthorizeService;
|
||||
import org.dspace.authorize.service.ResourcePolicyService;
|
||||
import org.dspace.content.Bitstream;
|
||||
|
@@ -23,7 +23,7 @@ import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
|
||||
import org.apache.commons.lang.ObjectUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.ReloadableEntity;
|
||||
|
@@ -15,8 +15,8 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang.ObjectUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.authorize.dao.ResourcePolicyDAO;
|
||||
import org.dspace.authorize.service.ResourcePolicyService;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
@@ -38,7 +38,7 @@ public class ResourcePolicyServiceImpl implements ResourcePolicyService {
|
||||
/**
|
||||
* log4j logger
|
||||
*/
|
||||
private static Logger log = Logger.getLogger(ResourcePolicyServiceImpl.class);
|
||||
private static Logger log = org.apache.logging.log4j.LogManager.getLogger(ResourcePolicyServiceImpl.class);
|
||||
|
||||
@Autowired(required = true)
|
||||
protected ContentServiceFactory contentServiceFactory;
|
||||
|
@@ -12,7 +12,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.content.Community;
|
||||
import org.dspace.content.Item;
|
||||
@@ -34,7 +34,7 @@ public class BrowseEngine {
|
||||
/**
|
||||
* the logger for this class
|
||||
*/
|
||||
private static final Logger log = Logger.getLogger(BrowseEngine.class);
|
||||
private static final Logger log = org.apache.logging.log4j.LogManager.getLogger(BrowseEngine.class);
|
||||
|
||||
/**
|
||||
* the browse scope which is the basis for our browse
|
||||
|
@@ -11,7 +11,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.content.Community;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
@@ -36,7 +36,7 @@ public class ItemCountDAOSolr implements ItemCountDAO {
|
||||
/**
|
||||
* Log4j logger
|
||||
*/
|
||||
private static Logger log = Logger.getLogger(ItemCountDAOSolr.class);
|
||||
private static Logger log = org.apache.logging.log4j.LogManager.getLogger(ItemCountDAOSolr.class);
|
||||
|
||||
/**
|
||||
* DSpace context
|
||||
|
@@ -9,7 +9,7 @@ package org.dspace.browse;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.content.Community;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
@@ -37,7 +37,7 @@ public class ItemCounter {
|
||||
/**
|
||||
* Log4j logger
|
||||
*/
|
||||
private static Logger log = Logger.getLogger(ItemCounter.class);
|
||||
private static Logger log = org.apache.logging.log4j.LogManager.getLogger(ItemCounter.class);
|
||||
|
||||
/**
|
||||
* DAO to use to store and retrieve data
|
||||
|
@@ -12,7 +12,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.dspace.services.ConfigurationService;
|
||||
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||
|
||||
|
@@ -12,7 +12,7 @@ import java.util.Locale;
|
||||
import com.ibm.icu.text.CollationElementIterator;
|
||||
import com.ibm.icu.text.Collator;
|
||||
import com.ibm.icu.text.RuleBasedCollator;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.core.ConfigurationManager;
|
||||
import org.dspace.text.filter.TextFilter;
|
||||
|
||||
@@ -32,7 +32,7 @@ import org.dspace.text.filter.TextFilter;
|
||||
* @author Graham Triggs
|
||||
*/
|
||||
public class LocaleOrderingFilter implements TextFilter {
|
||||
private static Logger log = Logger.getLogger(LocaleOrderingFilter.class);
|
||||
private static Logger log = org.apache.logging.log4j.LogManager.getLogger(LocaleOrderingFilter.class);
|
||||
|
||||
/**
|
||||
* Uses a Locale dependent Collator to generate a sort string
|
||||
|
@@ -16,7 +16,7 @@ import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.authorize.factory.AuthorizeServiceFactory;
|
||||
import org.dspace.authorize.service.AuthorizeService;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
@@ -68,7 +68,7 @@ public class SolrBrowseDAO implements BrowseDAO {
|
||||
/**
|
||||
* Log4j log
|
||||
*/
|
||||
private static final Logger log = Logger.getLogger(SolrBrowseDAO.class);
|
||||
private static final Logger log = org.apache.logging.log4j.LogManager.getLogger(SolrBrowseDAO.class);
|
||||
|
||||
/**
|
||||
* The DSpace context
|
||||
|
@@ -13,7 +13,7 @@ import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.checker.factory.CheckerServiceFactory;
|
||||
import org.dspace.checker.service.ChecksumHistoryService;
|
||||
import org.dspace.checker.service.ChecksumResultService;
|
||||
@@ -42,7 +42,7 @@ public final class CheckerCommand {
|
||||
/**
|
||||
* Usual Log4J logger.
|
||||
*/
|
||||
private static final Logger LOG = Logger.getLogger(CheckerCommand.class);
|
||||
private static final Logger LOG = org.apache.logging.log4j.LogManager.getLogger(CheckerCommand.class);
|
||||
|
||||
private Context context;
|
||||
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
package org.dspace.checker;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.checker.factory.CheckerServiceFactory;
|
||||
import org.dspace.checker.service.ChecksumHistoryService;
|
||||
import org.dspace.content.Bitstream;
|
||||
@@ -26,7 +26,7 @@ public class CheckerConsumer implements Consumer {
|
||||
/**
|
||||
* log4j logger
|
||||
*/
|
||||
private static Logger log = Logger.getLogger(CheckerConsumer.class);
|
||||
private static Logger log = org.apache.logging.log4j.LogManager.getLogger(CheckerConsumer.class);
|
||||
|
||||
protected ChecksumHistoryService checksumHistoryService = CheckerServiceFactory.getInstance()
|
||||
.getChecksumHistoryService();
|
||||
|
@@ -21,7 +21,7 @@ import org.apache.commons.cli.HelpFormatter;
|
||||
import org.apache.commons.cli.Options;
|
||||
import org.apache.commons.cli.ParseException;
|
||||
import org.apache.commons.cli.PosixParser;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.checker.factory.CheckerServiceFactory;
|
||||
import org.dspace.checker.service.SimpleReporterService;
|
||||
import org.dspace.core.ConfigurationManager;
|
||||
@@ -43,7 +43,7 @@ public class DailyReportEmailer {
|
||||
/**
|
||||
* log4j logger.
|
||||
*/
|
||||
private static Logger log = Logger.getLogger(DailyReportEmailer.class);
|
||||
private static Logger log = org.apache.logging.log4j.LogManager.getLogger(DailyReportEmailer.class);
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
|
@@ -12,7 +12,7 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.content.Bitstream;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.content.factory.ContentServiceFactory;
|
||||
@@ -35,7 +35,7 @@ public class HandleDispatcher implements BitstreamDispatcher {
|
||||
/**
|
||||
* Log 4j logger.
|
||||
*/
|
||||
private static final Logger LOG = Logger.getLogger(HandleDispatcher.class);
|
||||
private static final Logger LOG = org.apache.logging.log4j.LogManager.getLogger(HandleDispatcher.class);
|
||||
|
||||
protected Context context;
|
||||
|
||||
|
@@ -19,8 +19,8 @@ import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import javax.persistence.Transient;
|
||||
|
||||
import org.apache.commons.lang.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||
import org.apache.commons.lang3.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||
import org.dspace.content.Bitstream;
|
||||
|
||||
/**
|
||||
|
@@ -11,7 +11,7 @@ import java.sql.SQLException;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.checker.dao.MostRecentChecksumDAO;
|
||||
import org.dspace.checker.service.ChecksumResultService;
|
||||
import org.dspace.checker.service.MostRecentChecksumService;
|
||||
@@ -28,7 +28,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
* @author kevinvandevelde at atmire.com
|
||||
*/
|
||||
public class MostRecentChecksumServiceImpl implements MostRecentChecksumService {
|
||||
private static final Logger log = Logger.getLogger(MostRecentChecksumServiceImpl.class);
|
||||
private static final Logger log =
|
||||
org.apache.logging.log4j.LogManager.getLogger(MostRecentChecksumServiceImpl.class);
|
||||
|
||||
@Autowired(required = true)
|
||||
protected MostRecentChecksumDAO mostRecentChecksumDAO;
|
||||
|
@@ -12,7 +12,7 @@ import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.content.Bitstream;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.I18nUtil;
|
||||
@@ -30,7 +30,7 @@ public class ResultsLogger implements ChecksumResultsCollector {
|
||||
/**
|
||||
* Usual Log4J logger.
|
||||
*/
|
||||
private static final Logger LOG = Logger.getLogger(ResultsLogger.class);
|
||||
private static final Logger LOG = org.apache.logging.log4j.LogManager.getLogger(ResultsLogger.class);
|
||||
|
||||
/**
|
||||
* Utility date format.
|
||||
|
@@ -19,7 +19,7 @@ import java.util.Properties;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.checker.factory.CheckerServiceFactory;
|
||||
import org.dspace.checker.service.ChecksumHistoryService;
|
||||
import org.dspace.core.ConfigurationManager;
|
||||
@@ -40,7 +40,7 @@ public final class ResultsPruner {
|
||||
/**
|
||||
* Default logger.
|
||||
*/
|
||||
private static final Logger LOG = Logger.getLogger(ResultsPruner.class);
|
||||
private static final Logger LOG = org.apache.logging.log4j.LogManager.getLogger(ResultsPruner.class);
|
||||
|
||||
/**
|
||||
* Factory method for the default results pruner configuration using
|
||||
|
@@ -122,7 +122,8 @@ public class Bitstream extends DSpaceObject implements DSpaceObjectLegacySupport
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return getBitstreamService().getMetadataFirstValue(this, MetadataSchema.DC_SCHEMA, "title", null, Item.ANY);
|
||||
return getBitstreamService().getMetadataFirstValue(this, MetadataSchemaEnum.DC.getName(),
|
||||
"title", null, Item.ANY);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -133,7 +134,8 @@ public class Bitstream extends DSpaceObject implements DSpaceObjectLegacySupport
|
||||
* @throws SQLException if database error
|
||||
*/
|
||||
public void setName(Context context, String n) throws SQLException {
|
||||
getBitstreamService().setMetadataSingleValue(context, this, MetadataSchema.DC_SCHEMA, "title", null, null, n);
|
||||
getBitstreamService().setMetadataSingleValue(context, this, MetadataSchemaEnum.DC.getName(),
|
||||
"title", null, null, n);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -144,7 +146,8 @@ public class Bitstream extends DSpaceObject implements DSpaceObjectLegacySupport
|
||||
* @return the source of the bitstream
|
||||
*/
|
||||
public String getSource() {
|
||||
return getBitstreamService().getMetadataFirstValue(this, MetadataSchema.DC_SCHEMA, "source", null, Item.ANY);
|
||||
return getBitstreamService().getMetadataFirstValue(this, MetadataSchemaEnum.DC.getName(),
|
||||
"source", null, Item.ANY);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -155,7 +158,8 @@ public class Bitstream extends DSpaceObject implements DSpaceObjectLegacySupport
|
||||
* @throws SQLException if database error
|
||||
*/
|
||||
public void setSource(Context context, String n) throws SQLException {
|
||||
getBitstreamService().setMetadataSingleValue(context, this, MetadataSchema.DC_SCHEMA, "source", null, null, n);
|
||||
getBitstreamService().setMetadataSingleValue(context, this, MetadataSchemaEnum.DC.getName(),
|
||||
"source", null, null, n);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -166,7 +170,8 @@ public class Bitstream extends DSpaceObject implements DSpaceObjectLegacySupport
|
||||
*/
|
||||
public String getDescription() {
|
||||
return getBitstreamService()
|
||||
.getMetadataFirstValue(this, MetadataSchema.DC_SCHEMA, "description", null, Item.ANY);
|
||||
.getMetadataFirstValue(this, MetadataSchemaEnum.DC.getName(), "description",
|
||||
null, Item.ANY);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -178,7 +183,7 @@ public class Bitstream extends DSpaceObject implements DSpaceObjectLegacySupport
|
||||
*/
|
||||
public void setDescription(Context context, String n) throws SQLException {
|
||||
getBitstreamService()
|
||||
.setMetadataSingleValue(context, this, MetadataSchema.DC_SCHEMA, "description", null, null, n);
|
||||
.setMetadataSingleValue(context, this, MetadataSchemaEnum.DC.getName(), "description", null, null, n);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -227,7 +232,8 @@ public class Bitstream extends DSpaceObject implements DSpaceObjectLegacySupport
|
||||
* @return the user's format description.
|
||||
*/
|
||||
public String getUserFormatDescription() {
|
||||
return getBitstreamService().getMetadataFirstValue(this, MetadataSchema.DC_SCHEMA, "format", null, Item.ANY);
|
||||
return getBitstreamService().getMetadataFirstValue(this, MetadataSchemaEnum.DC.getName(),
|
||||
"format", null, Item.ANY);
|
||||
}
|
||||
|
||||
protected BitstreamFormat getBitstreamFormat() {
|
||||
|
@@ -12,7 +12,7 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.authorize.service.AuthorizeService;
|
||||
import org.dspace.content.dao.BitstreamFormatDAO;
|
||||
@@ -33,7 +33,7 @@ public class BitstreamFormatServiceImpl implements BitstreamFormatService {
|
||||
/**
|
||||
* log4j logger
|
||||
*/
|
||||
private static Logger log = Logger.getLogger(BitstreamFormat.class);
|
||||
private static Logger log = org.apache.logging.log4j.LogManager.getLogger(BitstreamFormat.class);
|
||||
|
||||
@Autowired(required = true)
|
||||
protected BitstreamFormatDAO bitstreamFormatDAO;
|
||||
|
@@ -15,8 +15,8 @@ import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.authorize.service.AuthorizeService;
|
||||
import org.dspace.content.dao.BitstreamDAO;
|
||||
@@ -43,7 +43,7 @@ public class BitstreamServiceImpl extends DSpaceObjectServiceImpl<Bitstream> imp
|
||||
/**
|
||||
* log4j logger
|
||||
*/
|
||||
private static Logger log = Logger.getLogger(BitstreamServiceImpl.class);
|
||||
private static Logger log = org.apache.logging.log4j.LogManager.getLogger(BitstreamServiceImpl.class);
|
||||
|
||||
|
||||
@Autowired(required = true)
|
||||
@@ -103,6 +103,8 @@ public class BitstreamServiceImpl extends DSpaceObjectServiceImpl<Bitstream> imp
|
||||
clonedBitstream.setSizeBytes(bitstream.getSizeBytes());
|
||||
clonedBitstream.setChecksum(bitstream.getChecksum());
|
||||
clonedBitstream.setChecksumAlgorithm(bitstream.getChecksumAlgorithm());
|
||||
clonedBitstream.setFormat(bitstream.getBitstreamFormat());
|
||||
|
||||
try {
|
||||
//Update our bitstream but turn off the authorization system since permissions
|
||||
//haven't been set at this point in time.
|
||||
@@ -203,7 +205,7 @@ public class BitstreamServiceImpl extends DSpaceObjectServiceImpl<Bitstream> imp
|
||||
@Override
|
||||
public void setUserFormatDescription(Context context, Bitstream bitstream, String desc) throws SQLException {
|
||||
setFormat(context, bitstream, null);
|
||||
setMetadataSingleValue(context, bitstream, MetadataSchema.DC_SCHEMA, "format", null, null, desc);
|
||||
setMetadataSingleValue(context, bitstream, MetadataSchemaEnum.DC.getName(), "format", null, null, desc);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -233,7 +235,7 @@ public class BitstreamServiceImpl extends DSpaceObjectServiceImpl<Bitstream> imp
|
||||
}
|
||||
|
||||
// Remove user type description
|
||||
clearMetadata(context, bitstream, MetadataSchema.DC_SCHEMA, "format", null, Item.ANY);
|
||||
clearMetadata(context, bitstream, MetadataSchemaEnum.DC.getName(), "format", null, Item.ANY);
|
||||
|
||||
// Update the ID in the table row
|
||||
bitstream.setFormat(bitstreamFormat);
|
||||
|
@@ -88,7 +88,7 @@ public class Bundle extends DSpaceObject implements DSpaceObjectLegacySupport {
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return getBundleService().getMetadataFirstValue(this, MetadataSchema.DC_SCHEMA, "title", null, Item.ANY);
|
||||
return getBundleService().getMetadataFirstValue(this, MetadataSchemaEnum.DC.getName(), "title", null, Item.ANY);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -100,7 +100,8 @@ public class Bundle extends DSpaceObject implements DSpaceObjectLegacySupport {
|
||||
* @throws SQLException if database error
|
||||
*/
|
||||
public void setName(Context context, String name) throws SQLException {
|
||||
getBundleService().setMetadataSingleValue(context, this, MetadataSchema.DC_SCHEMA, "title", null, null, name);
|
||||
getBundleService().setMetadataSingleValue(context, this, MetadataSchemaEnum.DC.getName(),
|
||||
"title", null, null, name);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -16,8 +16,8 @@ import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.authorize.AuthorizeConfiguration;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.authorize.ResourcePolicy;
|
||||
@@ -45,7 +45,7 @@ public class BundleServiceImpl extends DSpaceObjectServiceImpl<Bundle> implement
|
||||
/**
|
||||
* log4j logger
|
||||
*/
|
||||
private static Logger log = Logger.getLogger(Bundle.class);
|
||||
private static Logger log = org.apache.logging.log4j.LogManager.getLogger(Bundle.class);
|
||||
|
||||
@Autowired(required = true)
|
||||
protected BundleDAO bundleDAO;
|
||||
|
@@ -134,7 +134,7 @@ public class Collection extends DSpaceObject implements DSpaceObjectLegacySuppor
|
||||
@Override
|
||||
public String getName() {
|
||||
String value = getCollectionService()
|
||||
.getMetadataFirstValue(this, MetadataSchema.DC_SCHEMA, "title", null, Item.ANY);
|
||||
.getMetadataFirstValue(this, MetadataSchemaEnum.DC.getName(), "title", null, Item.ANY);
|
||||
return value == null ? "" : value;
|
||||
}
|
||||
|
||||
|
@@ -20,8 +20,8 @@ import java.util.MissingResourceException;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.app.util.AuthorizeUtil;
|
||||
import org.dspace.authorize.AuthorizeConfiguration;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
@@ -61,7 +61,7 @@ public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> i
|
||||
/**
|
||||
* log4j category
|
||||
*/
|
||||
private static final Logger log = Logger.getLogger(CollectionServiceImpl.class);
|
||||
private static final Logger log = org.apache.logging.log4j.LogManager.getLogger(CollectionServiceImpl.class);
|
||||
|
||||
@Autowired(required = true)
|
||||
protected CollectionDAO collectionDAO;
|
||||
@@ -143,10 +143,11 @@ public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> i
|
||||
|
||||
@Override
|
||||
public List<Collection> findAll(Context context) throws SQLException {
|
||||
MetadataField nameField = metadataFieldService.findByElement(context, MetadataSchema.DC_SCHEMA, "title", null);
|
||||
MetadataField nameField = metadataFieldService.findByElement(context, MetadataSchemaEnum.DC.getName(),
|
||||
"title", null);
|
||||
if (nameField == null) {
|
||||
throw new IllegalArgumentException(
|
||||
"Required metadata field '" + MetadataSchema.DC_SCHEMA + ".title' doesn't exist!");
|
||||
"Required metadata field '" + MetadataSchemaEnum.DC.getName() + ".title' doesn't exist!");
|
||||
}
|
||||
|
||||
return collectionDAO.findAll(context, nameField);
|
||||
@@ -154,10 +155,11 @@ public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> i
|
||||
|
||||
@Override
|
||||
public List<Collection> findAll(Context context, Integer limit, Integer offset) throws SQLException {
|
||||
MetadataField nameField = metadataFieldService.findByElement(context, MetadataSchema.DC_SCHEMA, "title", null);
|
||||
MetadataField nameField = metadataFieldService.findByElement(context, MetadataSchemaEnum.DC.getName(),
|
||||
"title", null);
|
||||
if (nameField == null) {
|
||||
throw new IllegalArgumentException(
|
||||
"Required metadata field '" + MetadataSchema.DC_SCHEMA + ".title' doesn't exist!");
|
||||
"Required metadata field '" + MetadataSchemaEnum.DC.getName() + ".title' doesn't exist!");
|
||||
}
|
||||
|
||||
return collectionDAO.findAll(context, nameField, limit, offset);
|
||||
|
@@ -23,8 +23,8 @@ import javax.persistence.OneToOne;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Transient;
|
||||
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.content.comparator.NameAscendingComparator;
|
||||
import org.dspace.content.factory.ContentServiceFactory;
|
||||
import org.dspace.content.service.CommunityService;
|
||||
@@ -52,7 +52,7 @@ public class Community extends DSpaceObject implements DSpaceObjectLegacySupport
|
||||
/**
|
||||
* log4j category
|
||||
*/
|
||||
private static final Logger log = Logger.getLogger(Community.class);
|
||||
private static final Logger log = org.apache.logging.log4j.LogManager.getLogger(Community.class);
|
||||
|
||||
@Column(name = "community_id", insertable = false, updatable = false)
|
||||
private Integer legacyId;
|
||||
@@ -254,7 +254,7 @@ public class Community extends DSpaceObject implements DSpaceObjectLegacySupport
|
||||
@Override
|
||||
public String getName() {
|
||||
String value = getCommunityService()
|
||||
.getMetadataFirstValue(this, MetadataSchema.DC_SCHEMA, "title", null, Item.ANY);
|
||||
.getMetadataFirstValue(this, MetadataSchemaEnum.DC.getName(), "title", null, Item.ANY);
|
||||
return value == null ? "" : value;
|
||||
}
|
||||
|
||||
|
@@ -17,8 +17,8 @@ import java.util.MissingResourceException;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.app.util.AuthorizeUtil;
|
||||
import org.dspace.authorize.AuthorizeConfiguration;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
@@ -51,7 +51,7 @@ public class CommunityServiceImpl extends DSpaceObjectServiceImpl<Community> imp
|
||||
/**
|
||||
* log4j category
|
||||
*/
|
||||
private static Logger log = Logger.getLogger(CommunityServiceImpl.class);
|
||||
private static Logger log = org.apache.logging.log4j.LogManager.getLogger(CommunityServiceImpl.class);
|
||||
|
||||
@Autowired(required = true)
|
||||
protected CommunityDAO communityDAO;
|
||||
@@ -139,10 +139,11 @@ public class CommunityServiceImpl extends DSpaceObjectServiceImpl<Community> imp
|
||||
|
||||
@Override
|
||||
public List<Community> findAll(Context context) throws SQLException {
|
||||
MetadataField sortField = metadataFieldService.findByElement(context, MetadataSchema.DC_SCHEMA, "title", null);
|
||||
MetadataField sortField = metadataFieldService.findByElement(context, MetadataSchemaEnum.DC.getName(),
|
||||
"title", null);
|
||||
if (sortField == null) {
|
||||
throw new IllegalArgumentException(
|
||||
"Required metadata field '" + MetadataSchema.DC_SCHEMA + ".title' doesn't exist!");
|
||||
"Required metadata field '" + MetadataSchemaEnum.DC.getName() + ".title' doesn't exist!");
|
||||
}
|
||||
|
||||
return communityDAO.findAll(context, sortField);
|
||||
@@ -150,10 +151,11 @@ public class CommunityServiceImpl extends DSpaceObjectServiceImpl<Community> imp
|
||||
|
||||
@Override
|
||||
public List<Community> findAll(Context context, Integer limit, Integer offset) throws SQLException {
|
||||
MetadataField nameField = metadataFieldService.findByElement(context, MetadataSchema.DC_SCHEMA, "title", null);
|
||||
MetadataField nameField = metadataFieldService.findByElement(context, MetadataSchemaEnum.DC.getName(),
|
||||
"title", null);
|
||||
if (nameField == null) {
|
||||
throw new IllegalArgumentException(
|
||||
"Required metadata field '" + MetadataSchema.DC_SCHEMA + ".title' doesn't exist!");
|
||||
"Required metadata field '" + MetadataSchemaEnum.DC.getName() + ".title' doesn't exist!");
|
||||
}
|
||||
|
||||
return communityDAO.findAll(context, nameField, limit, offset);
|
||||
@@ -162,10 +164,11 @@ public class CommunityServiceImpl extends DSpaceObjectServiceImpl<Community> imp
|
||||
@Override
|
||||
public List<Community> findAllTop(Context context) throws SQLException {
|
||||
// get all communities that are not children
|
||||
MetadataField sortField = metadataFieldService.findByElement(context, MetadataSchema.DC_SCHEMA, "title", null);
|
||||
MetadataField sortField = metadataFieldService.findByElement(context, MetadataSchemaEnum.DC.getName(),
|
||||
"title", null);
|
||||
if (sortField == null) {
|
||||
throw new IllegalArgumentException(
|
||||
"Required metadata field '" + MetadataSchema.DC_SCHEMA + ".title' doesn't exist!");
|
||||
"Required metadata field '" + MetadataSchemaEnum.DC.getName() + ".title' doesn't exist!");
|
||||
}
|
||||
|
||||
return communityDAO.findAllNoParent(context, sortField);
|
||||
|
@@ -18,7 +18,7 @@ import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
// FIXME: Not very robust - assumes dates will always be valid
|
||||
|
||||
@@ -45,7 +45,7 @@ public class DCDate {
|
||||
/**
|
||||
* Logger
|
||||
*/
|
||||
private static Logger log = Logger.getLogger(DCDate.class);
|
||||
private static Logger log = org.apache.logging.log4j.LogManager.getLogger(DCDate.class);
|
||||
|
||||
// UTC timezone
|
||||
private static final TimeZone utcZone = TimeZone.getTimeZone("UTC");
|
||||
|
@@ -18,9 +18,9 @@ import java.util.Map;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.content.authority.Choices;
|
||||
import org.dspace.content.authority.service.ChoiceAuthorityService;
|
||||
@@ -51,7 +51,7 @@ public abstract class DSpaceObjectServiceImpl<T extends DSpaceObject> implements
|
||||
/**
|
||||
* log4j category
|
||||
*/
|
||||
private static final Logger log = Logger.getLogger(DSpaceObjectServiceImpl.class);
|
||||
private static final Logger log = org.apache.logging.log4j.LogManager.getLogger(DSpaceObjectServiceImpl.class);
|
||||
|
||||
@Autowired(required = true)
|
||||
protected ChoiceAuthorityService choiceAuthorityService;
|
||||
@@ -74,7 +74,7 @@ public abstract class DSpaceObjectServiceImpl<T extends DSpaceObject> implements
|
||||
|
||||
@Override
|
||||
public String getName(T dso) {
|
||||
String value = getMetadataFirstValue(dso, MetadataSchema.DC_SCHEMA, "title", null, Item.ANY);
|
||||
String value = getMetadataFirstValue(dso, MetadataSchemaEnum.DC.getName(), "title", null, Item.ANY);
|
||||
return value == null ? "" : value;
|
||||
}
|
||||
|
||||
@@ -604,23 +604,23 @@ public abstract class DSpaceObjectServiceImpl<T extends DSpaceObject> implements
|
||||
protected String[] getMDValueByLegacyField(String field) {
|
||||
switch (field) {
|
||||
case "introductory_text":
|
||||
return new String[] {MetadataSchema.DC_SCHEMA, "description", null};
|
||||
return new String[] {MetadataSchemaEnum.DC.getName(), "description", null};
|
||||
case "short_description":
|
||||
return new String[] {MetadataSchema.DC_SCHEMA, "description", "abstract"};
|
||||
return new String[] {MetadataSchemaEnum.DC.getName(), "description", "abstract"};
|
||||
case "side_bar_text":
|
||||
return new String[] {MetadataSchema.DC_SCHEMA, "description", "tableofcontents"};
|
||||
return new String[] {MetadataSchemaEnum.DC.getName(), "description", "tableofcontents"};
|
||||
case "copyright_text":
|
||||
return new String[] {MetadataSchema.DC_SCHEMA, "rights", null};
|
||||
return new String[] {MetadataSchemaEnum.DC.getName(), "rights", null};
|
||||
case "name":
|
||||
return new String[] {MetadataSchema.DC_SCHEMA, "title", null};
|
||||
return new String[] {MetadataSchemaEnum.DC.getName(), "title", null};
|
||||
case "provenance_description":
|
||||
return new String[] {MetadataSchema.DC_SCHEMA, "provenance", null};
|
||||
return new String[] {MetadataSchemaEnum.DC.getName(), "provenance", null};
|
||||
case "license":
|
||||
return new String[] {MetadataSchema.DC_SCHEMA, "rights", "license"};
|
||||
return new String[] {MetadataSchemaEnum.DC.getName(), "rights", "license"};
|
||||
case "user_format_description":
|
||||
return new String[] {MetadataSchema.DC_SCHEMA, "format", null};
|
||||
return new String[] {MetadataSchemaEnum.DC.getName(), "format", null};
|
||||
case "source":
|
||||
return new String[] {MetadataSchema.DC_SCHEMA, "source", null};
|
||||
return new String[] {MetadataSchemaEnum.DC.getName(), "source", null};
|
||||
case "firstname":
|
||||
return new String[] {"eperson", "firstname", null};
|
||||
case "lastname":
|
||||
|
@@ -12,7 +12,7 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.dspace.content.service.EntityService;
|
||||
import org.dspace.content.service.EntityTypeService;
|
||||
import org.dspace.content.service.ItemService;
|
||||
|
@@ -104,9 +104,10 @@ public class InstallItemServiceImpl implements InstallItemService {
|
||||
|
||||
// If the item doesn't have a date.accessioned, set it to today
|
||||
List<MetadataValue> dateAccessioned = itemService
|
||||
.getMetadata(item, MetadataSchema.DC_SCHEMA, "date", "accessioned", Item.ANY);
|
||||
.getMetadata(item, MetadataSchemaEnum.DC.getName(), "date", "accessioned", Item.ANY);
|
||||
if (dateAccessioned.isEmpty()) {
|
||||
itemService.addMetadata(c, item, MetadataSchema.DC_SCHEMA, "date", "accessioned", null, now.toString());
|
||||
itemService.addMetadata(c, item, MetadataSchemaEnum.DC.getName(),
|
||||
"date", "accessioned", null, now.toString());
|
||||
}
|
||||
|
||||
// If issue date is set as "today" (literal string), then set it to current date
|
||||
@@ -114,8 +115,8 @@ public class InstallItemServiceImpl implements InstallItemService {
|
||||
// replacing "today" with today's date.
|
||||
// NOTE: As of DSpace 4.0, DSpace no longer sets an issue date by default
|
||||
List<MetadataValue> currentDateIssued = itemService
|
||||
.getMetadata(item, MetadataSchema.DC_SCHEMA, "date", "issued", Item.ANY);
|
||||
itemService.clearMetadata(c, item, MetadataSchema.DC_SCHEMA, "date", "issued", Item.ANY);
|
||||
.getMetadata(item, MetadataSchemaEnum.DC.getName(), "date", "issued", Item.ANY);
|
||||
itemService.clearMetadata(c, item, MetadataSchemaEnum.DC.getName(), "date", "issued", Item.ANY);
|
||||
for (MetadataValue dcv : currentDateIssued) {
|
||||
if (dcv.getValue() != null && dcv.getValue().equalsIgnoreCase("today")) {
|
||||
DCDate issued = new DCDate(now.getYear(), now.getMonth(), now.getDay(), -1, -1, -1);
|
||||
@@ -127,7 +128,8 @@ public class InstallItemServiceImpl implements InstallItemService {
|
||||
|
||||
// Record that the item was restored
|
||||
String provDescription = "Restored into DSpace on " + now + " (GMT).";
|
||||
itemService.addMetadata(c, item, MetadataSchema.DC_SCHEMA, "description", "provenance", "en", provDescription);
|
||||
itemService.addMetadata(c, item, MetadataSchemaEnum.DC.getName(),
|
||||
"description", "provenance", "en", provDescription);
|
||||
|
||||
return finishItem(c, item, is);
|
||||
}
|
||||
@@ -137,14 +139,16 @@ public class InstallItemServiceImpl implements InstallItemService {
|
||||
throws SQLException, AuthorizeException {
|
||||
// create accession date
|
||||
DCDate now = DCDate.getCurrent();
|
||||
itemService.addMetadata(c, item, MetadataSchema.DC_SCHEMA, "date", "accessioned", null, now.toString());
|
||||
itemService.addMetadata(c, item, MetadataSchemaEnum.DC.getName(),
|
||||
"date", "accessioned", null, now.toString());
|
||||
|
||||
// add date available if not under embargo, otherwise it will
|
||||
// be set when the embargo is lifted.
|
||||
// this will flush out fatal embargo metadata
|
||||
// problems before we set inArchive.
|
||||
if (embargoService.getEmbargoTermsAsDate(c, item) == null) {
|
||||
itemService.addMetadata(c, item, MetadataSchema.DC_SCHEMA, "date", "available", null, now.toString());
|
||||
itemService.addMetadata(c, item, MetadataSchemaEnum.DC.getName(),
|
||||
"date", "available", null, now.toString());
|
||||
}
|
||||
|
||||
// If issue date is set as "today" (literal string), then set it to current date
|
||||
@@ -152,8 +156,8 @@ public class InstallItemServiceImpl implements InstallItemService {
|
||||
// replacing "today" with today's date.
|
||||
// NOTE: As of DSpace 4.0, DSpace no longer sets an issue date by default
|
||||
List<MetadataValue> currentDateIssued = itemService
|
||||
.getMetadata(item, MetadataSchema.DC_SCHEMA, "date", "issued", Item.ANY);
|
||||
itemService.clearMetadata(c, item, MetadataSchema.DC_SCHEMA, "date", "issued", Item.ANY);
|
||||
.getMetadata(item, MetadataSchemaEnum.DC.getName(), "date", "issued", Item.ANY);
|
||||
itemService.clearMetadata(c, item, MetadataSchemaEnum.DC.getName(), "date", "issued", Item.ANY);
|
||||
for (MetadataValue dcv : currentDateIssued) {
|
||||
if (dcv.getValue() != null && dcv.getValue().equalsIgnoreCase("today")) {
|
||||
DCDate issued = new DCDate(now.getYear(), now.getMonth(), now.getDay(), -1, -1, -1);
|
||||
@@ -178,7 +182,8 @@ public class InstallItemServiceImpl implements InstallItemService {
|
||||
}
|
||||
|
||||
// Add provenance description
|
||||
itemService.addMetadata(c, item, MetadataSchema.DC_SCHEMA, "description", "provenance", "en", provDescription);
|
||||
itemService.addMetadata(c, item, MetadataSchemaEnum.DC.getName(),
|
||||
"description", "provenance", "en", provDescription);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -352,7 +352,7 @@ public class Item extends DSpaceObject implements DSpaceObjectLegacySupport {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return getItemService().getMetadataFirstValue(this, MetadataSchema.DC_SCHEMA, "title", null, Item.ANY);
|
||||
return getItemService().getMetadataFirstValue(this, MetadataSchemaEnum.DC.getName(), "title", null, Item.ANY);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -15,7 +15,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||
import org.dspace.content.factory.ContentServiceFactory;
|
||||
import org.dspace.content.service.ItemService;
|
||||
import org.dspace.sort.OrderFormat;
|
||||
@@ -174,7 +174,7 @@ public class ItemComparator implements Comparator, Serializable {
|
||||
protected String getValue(Item item) {
|
||||
// The overall array and each element are guaranteed non-null
|
||||
List<MetadataValue> dcvalues = itemService
|
||||
.getMetadata(item, MetadataSchema.DC_SCHEMA, element, qualifier, language);
|
||||
.getMetadata(item, MetadataSchemaEnum.DC.getName(), element, qualifier, language);
|
||||
|
||||
if (dcvalues.isEmpty()) {
|
||||
return null;
|
||||
|
@@ -21,7 +21,7 @@ import java.util.UUID;
|
||||
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.app.util.AuthorizeUtil;
|
||||
import org.dspace.authorize.AuthorizeConfiguration;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
@@ -69,7 +69,7 @@ public class ItemServiceImpl extends DSpaceObjectServiceImpl<Item> implements It
|
||||
/**
|
||||
* log4j category
|
||||
*/
|
||||
private static final Logger log = Logger.getLogger(Item.class);
|
||||
private static final Logger log = org.apache.logging.log4j.LogManager.getLogger(Item.class);
|
||||
|
||||
@Autowired(required = true)
|
||||
protected ItemDAO itemDAO;
|
||||
@@ -230,10 +230,10 @@ public class ItemServiceImpl extends DSpaceObjectServiceImpl<Item> implements It
|
||||
throws SQLException {
|
||||
|
||||
MetadataField metadataField = metadataFieldService
|
||||
.findByElement(context, MetadataSchema.DC_SCHEMA, "date", "accessioned");
|
||||
.findByElement(context, MetadataSchemaEnum.DC.getName(), "date", "accessioned");
|
||||
if (metadataField == null) {
|
||||
throw new IllegalArgumentException(
|
||||
"Required metadata field '" + MetadataSchema.DC_SCHEMA + ".date.accessioned' doesn't exist!");
|
||||
"Required metadata field '" + MetadataSchemaEnum.DC.getName() + ".date.accessioned' doesn't exist!");
|
||||
}
|
||||
|
||||
return itemDAO.findBySubmitter(context, eperson, metadataField, limit);
|
||||
@@ -554,7 +554,7 @@ public class ItemServiceImpl extends DSpaceObjectServiceImpl<Item> implements It
|
||||
|
||||
prov.append(installItemService.getBitstreamProvenanceMessage(context, item));
|
||||
|
||||
addMetadata(context, item, MetadataSchema.DC_SCHEMA, "description", "provenance", "en", prov.toString());
|
||||
addMetadata(context, item, MetadataSchemaEnum.DC.getName(), "description", "provenance", "en", prov.toString());
|
||||
|
||||
// Update item in DB
|
||||
update(context, item);
|
||||
@@ -609,7 +609,7 @@ public class ItemServiceImpl extends DSpaceObjectServiceImpl<Item> implements It
|
||||
// bitstream checksums
|
||||
prov.append(installItemService.getBitstreamProvenanceMessage(context, item));
|
||||
|
||||
addMetadata(context, item, MetadataSchema.DC_SCHEMA, "description", "provenance", "en", prov.toString());
|
||||
addMetadata(context, item, MetadataSchemaEnum.DC.getName(), "description", "provenance", "en", prov.toString());
|
||||
|
||||
// Update item in DB
|
||||
update(context, item);
|
||||
@@ -1292,7 +1292,9 @@ prevent the generation of resource policy entry values with null dspace_object a
|
||||
*/
|
||||
@Override
|
||||
public List<MetadataValue> getMetadata(Item item, String schema, String element, String qualifier, String lang) {
|
||||
if (StringUtils.equals(schema, "relation") && !StringUtils.equals(element, "type")) {
|
||||
//Fields of the relation schema are virtual metadata
|
||||
//except for relation.type which is the type of item in the model
|
||||
if (StringUtils.equals(schema, MetadataSchemaEnum.RELATION.getName()) && !StringUtils.equals(element, "type")) {
|
||||
|
||||
List<RelationshipMetadataValue> relationMetadata = getRelationshipMetadata(item, false);
|
||||
List<MetadataValue> listToReturn = new LinkedList<>();
|
||||
@@ -1320,7 +1322,7 @@ prevent the generation of resource policy entry values with null dspace_object a
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RelationshipMetadataValue> getRelationshipMetadata(Item item, boolean extra) {
|
||||
public List<RelationshipMetadataValue> getRelationshipMetadata(Item item, boolean enableVirtualMetadata) {
|
||||
Context context = new Context();
|
||||
List<RelationshipMetadataValue> fullMetadataValueList = new LinkedList<>();
|
||||
try {
|
||||
@@ -1329,8 +1331,8 @@ prevent the generation of resource policy entry values with null dspace_object a
|
||||
if (StringUtils.isNotBlank(entityType)) {
|
||||
List<Relationship> relationships = relationshipService.findByItem(context, item);
|
||||
for (Relationship relationship : relationships) {
|
||||
fullMetadataValueList
|
||||
.addAll(handleItemRelationship(context, item, entityType, relationship, extra));
|
||||
fullMetadataValueList.addAll(handleItemRelationship(context, item, entityType,
|
||||
relationship, enableVirtualMetadata));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1341,7 +1343,7 @@ prevent the generation of resource policy entry values with null dspace_object a
|
||||
}
|
||||
|
||||
private List<RelationshipMetadataValue> handleItemRelationship(Context context, Item item, String entityType,
|
||||
Relationship relationship, boolean extra)
|
||||
Relationship relationship, boolean enableVirtualMetadata)
|
||||
throws SQLException {
|
||||
List<RelationshipMetadataValue> resultingMetadataValueList = new LinkedList<>();
|
||||
RelationshipType relationshipType = relationship.getRelationshipType();
|
||||
@@ -1360,7 +1362,7 @@ prevent the generation of resource policy entry values with null dspace_object a
|
||||
relationName = relationship.getRelationshipType().getRightLabel();
|
||||
}
|
||||
|
||||
if (hashMaps != null && extra) {
|
||||
if (hashMaps != null && enableVirtualMetadata) {
|
||||
resultingMetadataValueList.addAll(handleRelationshipTypeMetadataMappping(context, item, hashMaps,
|
||||
otherItem, relationName,
|
||||
relationship.getID()));
|
||||
@@ -1378,12 +1380,13 @@ prevent the generation of resource policy entry values with null dspace_object a
|
||||
String key = entry.getKey();
|
||||
VirtualBean virtualBean = entry.getValue();
|
||||
|
||||
RelationshipMetadataValue metadataValue = constructMetadataValue(context, key);
|
||||
metadataValue = constructResultingMetadataValue(context, item, otherItem, virtualBean, metadataValue,
|
||||
relationshipId);
|
||||
metadataValue.setUseForPlace(virtualBean.getUseForPlace());
|
||||
if (StringUtils.isNotBlank(metadataValue.getValue())) {
|
||||
resultingMetadataValueList.add(metadataValue);
|
||||
for (String value : virtualBean.getValues(context, otherItem)) {
|
||||
RelationshipMetadataValue metadataValue = constructMetadataValue(context, key);
|
||||
metadataValue = constructResultingMetadataValue(item, value, metadataValue, relationshipId);
|
||||
metadataValue.setUseForPlace(virtualBean.getUseForPlace());
|
||||
if (StringUtils.isNotBlank(metadataValue.getValue())) {
|
||||
resultingMetadataValueList.add(metadataValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
return resultingMetadataValueList;
|
||||
@@ -1392,7 +1395,9 @@ prevent the generation of resource policy entry values with null dspace_object a
|
||||
private RelationshipMetadataValue getRelationMetadataFromOtherItem(Context context, Item otherItem,
|
||||
String relationName,
|
||||
Integer relationshipId) {
|
||||
RelationshipMetadataValue metadataValue = constructMetadataValue(context, "relation." + relationName);
|
||||
RelationshipMetadataValue metadataValue = constructMetadataValue(context,
|
||||
MetadataSchemaEnum.RELATION
|
||||
.getName() + "." + relationName);
|
||||
metadataValue.setAuthority("virtual::" + relationshipId);
|
||||
metadataValue.setValue(otherItem.getID().toString());
|
||||
return metadataValue;
|
||||
@@ -1412,12 +1417,10 @@ prevent the generation of resource policy entry values with null dspace_object a
|
||||
return entityType;
|
||||
}
|
||||
|
||||
private RelationshipMetadataValue constructResultingMetadataValue(Context context, Item item, Item otherItem,
|
||||
VirtualBean virtualBean,
|
||||
private RelationshipMetadataValue constructResultingMetadataValue(Item item, String value,
|
||||
RelationshipMetadataValue metadataValue,
|
||||
Integer relationshipId)
|
||||
throws SQLException {
|
||||
metadataValue.setValue(virtualBean.getValue(context, otherItem));
|
||||
int relationshipId) {
|
||||
metadataValue.setValue(value);
|
||||
metadataValue.setAuthority("virtual::" + relationshipId);
|
||||
metadataValue.setConfidence(-1);
|
||||
metadataValue.setDSpaceObject(item);
|
||||
|
@@ -12,7 +12,7 @@ import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.authorize.service.AuthorizeService;
|
||||
import org.dspace.content.dao.MetadataFieldDAO;
|
||||
@@ -33,7 +33,7 @@ public class MetadataFieldServiceImpl implements MetadataFieldService {
|
||||
/**
|
||||
* log4j logger
|
||||
*/
|
||||
private static Logger log = Logger.getLogger(MetadataFieldServiceImpl.class);
|
||||
private static Logger log = org.apache.logging.log4j.LogManager.getLogger(MetadataFieldServiceImpl.class);
|
||||
|
||||
@Autowired(required = true)
|
||||
protected MetadataFieldDAO metadataFieldDAO;
|
||||
|
@@ -39,10 +39,6 @@ import org.hibernate.proxy.HibernateProxyHelper;
|
||||
@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
|
||||
@Table(name = "metadataschemaregistry")
|
||||
public class MetadataSchema implements ReloadableEntity<Integer> {
|
||||
/**
|
||||
* Short Name of built-in Dublin Core schema.
|
||||
*/
|
||||
public static final String DC_SCHEMA = "dc";
|
||||
|
||||
@Id
|
||||
@Column(name = "metadata_schema_id")
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user