Wire the ClassificationServiceDAO using Spring injection.

Also small change to lower visibility of ClassificationServiceDAO member
variables from public to private.

+review RM @nmcerlean @rwetherall

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@100721 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tom Page
2015-03-30 14:49:10 +00:00
parent 95262cfdc4
commit f95eabd052
5 changed files with 31 additions and 40 deletions

View File

@@ -40,14 +40,14 @@ import org.json.JSONTokener;
*/
class ClassificationServiceDAO
{
public final String levelConfigLocation;
public final String reasonConfigLocation;
private String levelConfigLocation;
private String reasonConfigLocation;
public ClassificationServiceDAO(String levelConfigLocation, String reasonConfigLocation)
{
this.levelConfigLocation = levelConfigLocation;
this.reasonConfigLocation = reasonConfigLocation;
}
/** Set the location of the level configuration file relative to the classpath. */
public void setLevelConfigLocation(String levelConfigLocation) { this.levelConfigLocation = levelConfigLocation; }
/** Set the location of the reasons configuration file relative to the classpath. */
public void setReasonConfigLocation(String reasonConfigLocation) { this.reasonConfigLocation = reasonConfigLocation; }
/**
* Gets the list (in descending order) of classification levels - as defined in the classpath.

View File

@@ -44,36 +44,19 @@ public class ClassificationServiceImpl extends ServiceBaseImpl
"classification.reasons" };
private static final Logger LOGGER = LoggerFactory.getLogger(ClassificationServiceImpl.class);
static final String DEFAULT_CONFIG_DIRECTORY = "/alfresco/module/org_alfresco_module_rm/classification/";
static final String DEFAULT_LEVELS_FILE = DEFAULT_CONFIG_DIRECTORY + "rm-classification-levels.json";
static final String DEFAULT_REASONS_FILE = DEFAULT_CONFIG_DIRECTORY + "rm-classification-reasons.json";
private AttributeService attributeService; // TODO What about other code (e.g. REST API) accessing the AttrService?
private ClassificationServiceDAO classificationServiceDao;
/** The classification levels currently configured in this server. */
private List<ClassificationLevel> configuredLevels;
/** The classification reasons currently configured in this server. */
private List<ClassificationReason> configuredReasons;
private final ClassificationServiceDAO classificationServiceDao;
public ClassificationServiceImpl()
{
this.classificationServiceDao = new ClassificationServiceDAO(DEFAULT_LEVELS_FILE, DEFAULT_REASONS_FILE);
}
/**
* Package protected constructor, primarily for unit testing purposes.
*
* @param classificationServiceDao The object from which configuration options will be read.
*/
ClassificationServiceImpl(ClassificationServiceDAO classificationServiceDao)
{
this.classificationServiceDao = classificationServiceDao;
}
public void setAttributeService(AttributeService service) { this.attributeService = service; }
/** Set the object from which configuration options will be read. */
public void setClassificationServiceDAO(ClassificationServiceDAO classificationServiceDao) { this.classificationServiceDao = classificationServiceDao; }
void initConfiguredClassificationLevels()
{
final List<ClassificationLevel> allPersistedLevels = getPersistedLevels();