Skip to content

Commit

Permalink
Replace use of commons-logging with slf4j
Browse files Browse the repository at this point in the history
commons-logging is used although we should use the logging facade slf4j
so we are independent of the actual logging implementation of
openmrs-core. commons-logging is actually excluded from the
openmrs-core dependencies but somehow kreeped in.

* replace usage of commons-logging with slf4j
* add rule to checktsyle.xml to flag imports of commons-logging
as illegal
* order imports according to eclipse default, remove unused imports
  • Loading branch information
teleivo committed Mar 15, 2017
1 parent 2d2d98a commit 61fced0
Show file tree
Hide file tree
Showing 44 changed files with 158 additions and 169 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
*/
package org.openmrs.module.radiology;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.openmrs.module.BaseModuleActivator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* This class contains the logic that is run every time this module is either started or shutdown
Expand All @@ -20,7 +20,7 @@
public class RadiologyActivator extends BaseModuleActivator {


private static final Log log = LogFactory.getLog(RadiologyActivator.class);
private static final Logger log = LoggerFactory.getLogger(RadiologyActivator.class);

@Override
public void willStart() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@
*/
package org.openmrs.module.radiology.modality;

import java.util.ArrayList;
import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.Restrictions;
import org.openmrs.module.radiology.report.template.MrrtReportTemplate;

import java.util.ArrayList;
import java.util.List;

/**
* Hibernate specific RadiologyModality related functions. This class should not be used directly. All
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
*/
package org.openmrs.module.radiology.modality;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.openmrs.api.context.Context;
import org.springframework.util.StringUtils;

Expand All @@ -25,8 +25,7 @@
*/
public class RadiologyModalityEditor extends PropertyEditorSupport {


private final Log log = LogFactory.getLog(this.getClass());
private final Logger log = LoggerFactory.getLogger(this.getClass());

/**
* @should set value to radiology modality whos id matches given text
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
*/
package org.openmrs.module.radiology.modality;

import java.util.List;

import org.openmrs.annotation.Authorized;
import org.openmrs.api.APIException;
import org.openmrs.api.OpenmrsService;
import org.openmrs.module.radiology.RadiologyPrivileges;

import java.util.List;

/**
* Service layer for {@code RadiologyModality}.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@
*/
package org.openmrs.module.radiology.modality;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import java.util.List;

import org.apache.commons.lang3.StringUtils;
import org.openmrs.api.context.Context;
import org.openmrs.api.impl.BaseOpenmrsService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.transaction.annotation.Transactional;
import org.apache.commons.lang3.StringUtils;

import java.util.List;

@Transactional(readOnly = true)
class RadiologyModalityServiceImpl extends BaseOpenmrsService implements RadiologyModalityService {


private static final Log log = LogFactory.getLog(RadiologyModalityServiceImpl.class);
private static final Logger log = LoggerFactory.getLogger(RadiologyModalityServiceImpl.class);

private RadiologyModalityDAO radiologyModalityDAO;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
package org.openmrs.module.radiology.modality;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.openmrs.annotation.Handler;
import org.openmrs.validator.ValidateUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
Expand All @@ -27,7 +27,7 @@
public class RadiologyModalityValidator implements Validator {


protected final Log log = LogFactory.getLog(RadiologyModalityValidator.class);
protected final Logger log = LoggerFactory.getLogger(RadiologyModalityValidator.class);

static int MAX_LENGTH_AE_TITLE = 16;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@

import java.util.Date;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.openmrs.Encounter;
import org.openmrs.Order;
import org.openmrs.annotation.Handler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
Expand All @@ -29,8 +29,8 @@
public class RadiologyOrderValidator implements Validator {


/** Log for this class and subclasses */
protected final Log log = LogFactory.getLog(getClass());
/** Logger for this class and subclasses */
protected final Logger log = LoggerFactory.getLogger(getClass());

/**
* Determines if the command object being submitted is a valid type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

import java.beans.PropertyEditorSupport;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.openmrs.api.context.Context;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.StringUtils;

/**
Expand All @@ -26,7 +26,7 @@
public class RadiologyReportEditor extends PropertyEditorSupport {


private final Log log = LogFactory.getLog(this.getClass());
private final Logger log = LoggerFactory.getLogger(this.getClass());

/**
* @should set value to radiology report whos id matches given text
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@
import java.util.List;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.openmrs.api.APIException;
import org.openmrs.api.impl.BaseOpenmrsService;
import org.openmrs.module.radiology.order.RadiologyOrder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.transaction.annotation.Transactional;

@Transactional(readOnly = true)
class RadiologyReportServiceImpl extends BaseOpenmrsService implements RadiologyReportService {


private static final Log log = LogFactory.getLog(RadiologyReportServiceImpl.class);
private static final Logger log = LoggerFactory.getLogger(RadiologyReportServiceImpl.class);

private RadiologyReportDAO radiologyReportDAO;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
*/
package org.openmrs.module.radiology.report;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.openmrs.annotation.Handler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
Expand All @@ -25,7 +25,7 @@
public class RadiologyReportValidator implements Validator {


protected final Log log = LogFactory.getLog(RadiologyReportValidator.class);
protected final Logger log = LoggerFactory.getLogger(RadiologyReportValidator.class);

/**
* Determines if the command object being submitted is a valid type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
Expand All @@ -31,6 +29,8 @@
import org.openmrs.api.APIException;
import org.openmrs.api.ConceptService;
import org.openmrs.api.context.Context;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;

Expand All @@ -40,7 +40,7 @@
class DefaultMrrtReportTemplateFileParser implements MrrtReportTemplateFileParser {


private static final Log log = LogFactory.getLog(DefaultMrrtReportTemplateFileParser.class);
private static final Logger log = LoggerFactory.getLogger(DefaultMrrtReportTemplateFileParser.class);

private static final String DCTERMS_TITLE = "dcterms.title";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
*/
package org.openmrs.module.radiology.report.template;

import org.jsoup.select.Elements;

import java.util.function.Predicate;

import org.jsoup.select.Elements;

/**
* Checks a condition on a subset of elements matching a selector.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
*/
package org.openmrs.module.radiology.report.template;

import org.jsoup.select.Elements;

import java.util.ArrayList;
import java.util.List;

import org.jsoup.select.Elements;

/**
* Validates <meta> tags of an Mrrt Report Template.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

import java.beans.PropertyEditorSupport;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.openmrs.api.context.Context;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;

Expand All @@ -28,7 +28,7 @@
public class MrrtReportTemplateEditor extends PropertyEditorSupport {


private final Log log = LogFactory.getLog(this.getClass());
private final Logger log = LoggerFactory.getLogger(this.getClass());

/**
* @should set value to mrrt report template whos id matches given text
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@
import java.util.List;

import org.apache.commons.io.FileUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.openmrs.api.APIException;
import org.openmrs.api.impl.BaseOpenmrsService;
import org.openmrs.module.radiology.RadiologyProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.transaction.annotation.Transactional;

@Transactional(readOnly = true)
class MrrtReportTemplateServiceImpl extends BaseOpenmrsService implements MrrtReportTemplateService {


private static final Log log = LogFactory.getLog(MrrtReportTemplateServiceImpl.class);
private static final Logger log = LoggerFactory.getLogger(MrrtReportTemplateServiceImpl.class);

private MrrtReportTemplateFileParser parser;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
*/
package org.openmrs.module.radiology.report.template;

import org.openmrs.api.APIException;

import java.io.IOException;

import org.openmrs.api.APIException;

/**
* Validates an mrrt report template according to the IHE Management of Radiology Report Templates (MRRT).
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
import javax.xml.validation.Validator;

import org.apache.commons.io.IOUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;
import org.openmrs.api.APIException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
Expand All @@ -36,7 +36,7 @@
public class XsdMrrtReportTemplateValidator implements MrrtReportTemplateValidator {


private static final Log log = LogFactory.getLog(XsdMrrtReportTemplateValidator.class);
private static final Logger log = LoggerFactory.getLogger(XsdMrrtReportTemplateValidator.class);

private static final String MRRT_REPORT_TEMPLATE_SCHEMA_FILE = "MrrtReportTemplateSchema.xsd";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

import java.beans.PropertyEditorSupport;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.openmrs.api.context.Context;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.StringUtils;

/**
Expand All @@ -26,7 +26,7 @@
public class RadiologyStudyEditor extends PropertyEditorSupport {


private final Log log = LogFactory.getLog(this.getClass());
private final Logger log = LoggerFactory.getLogger(this.getClass());

/**
* @should set value to radiology study whos id matches given text
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
package org.openmrs.module.radiology.study;

import org.openmrs.annotation.Authorized;
import org.openmrs.api.APIException;
import org.openmrs.api.OpenmrsService;
import org.openmrs.module.radiology.RadiologyPrivileges;

Expand Down
Loading

0 comments on commit 61fced0

Please sign in to comment.