Rename ClassificationService to ClassificationSchemeService.

Also rename ClassificationServiceException to ClassificationException.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@105317 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tom Page
2015-06-02 10:20:37 +00:00
parent 81dbb54471
commit ae171d5008
36 changed files with 160 additions and 161 deletions

View File

@@ -22,21 +22,21 @@ import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.service.cmr.repository.NodeRef;
/**
* Generic class for any runtime exception thrown within the {@link ClassificationService}.
* Generic class for any runtime exception to do with classified records.
*
* @author Neil Mc Erlean
* @since 3.0
*/
public class ClassificationServiceException extends AlfrescoRuntimeException
public class ClassificationException extends AlfrescoRuntimeException
{
/** serial version uid */
private static final long serialVersionUID = -7097573558438226725L;
public ClassificationServiceException(String msgId) { super(msgId); }
public ClassificationServiceException(String msgId, Throwable cause) { super(msgId, cause); }
public ClassificationException(String msgId) { super(msgId); }
public ClassificationException(String msgId, Throwable cause) { super(msgId, cause); }
/** Represents a fatal error due to missing required configuration. */
public static class MissingConfiguration extends ClassificationServiceException
public static class MissingConfiguration extends ClassificationException
{
/** serial version uid */
private static final long serialVersionUID = -750162955179494445L;
@@ -46,7 +46,7 @@ public class ClassificationServiceException extends AlfrescoRuntimeException
/** Represents a fatal error due to illegal configuration.
* The configuration was understood by the server, but was rejected as illegal. */
public static class IllegalConfiguration extends ClassificationServiceException
public static class IllegalConfiguration extends ClassificationException
{
/** serial version uid */
private static final long serialVersionUID = -1139626996782741741L;
@@ -56,7 +56,7 @@ public class ClassificationServiceException extends AlfrescoRuntimeException
/** Represents a fatal error due to malformed configuration.
* The configuration could not be understood by the server. */
public static class MalformedConfiguration extends ClassificationServiceException
public static class MalformedConfiguration extends ClassificationException
{
/** serial version uid */
private static final long serialVersionUID = 8191162359241035026L;
@@ -66,7 +66,7 @@ public class ClassificationServiceException extends AlfrescoRuntimeException
}
/** The supplied classification level id was not found in the configured list. */
public static class LevelIdNotFound extends ClassificationServiceException
public static class LevelIdNotFound extends ClassificationException
{
/** serial version uid */
private static final long serialVersionUID = -8507186704795004383L;
@@ -78,7 +78,7 @@ public class ClassificationServiceException extends AlfrescoRuntimeException
}
/** The supplied classification reason id was not found in the configured list. */
public static class ReasonIdNotFound extends ClassificationServiceException
public static class ReasonIdNotFound extends ClassificationException
{
/** serial version uid */
private static final long serialVersionUID = -643842413653375433L;
@@ -89,7 +89,7 @@ public class ClassificationServiceException extends AlfrescoRuntimeException
}
}
public static class InvalidNode extends ClassificationServiceException
public static class InvalidNode extends ClassificationException
{
/** serial version uid */
private static final long serialVersionUID = -4485335425932302477L;

View File

@@ -29,20 +29,20 @@ import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter;
import org.alfresco.service.cmr.repository.datatype.TypeConversionException;
/**
* Check that a value is a valid {@link ClassificationLevel} by checking the {@link ClassificationService}.
*
* Check that a value is a valid {@link ClassificationLevel} by checking the {@link ClassificationSchemeService}.
*
* @author tpage
*/
public class ClassificationLevelConstraint extends AbstractConstraint
{
/** The classification service provides access to the valid classification levels. */
private ClassificationService classificationService;
/** The classification scheme service provides access to the valid classification levels. */
private ClassificationSchemeService classificationSchemeService;
/** Constraints must use a default constructor. */
public ClassificationLevelConstraint()
{
super();
this.classificationService = ClassificationServiceProvider.getClassificationService();
this.classificationSchemeService = ClassificationSchemeServiceProvider.getClassificationSchemeService();
}
@Override
@@ -59,12 +59,12 @@ public class ClassificationLevelConstraint extends AbstractConstraint
/**
* Get the allowed values. Note that these are <tt>String</tt> instances, but may
* represent non-<tt>String</tt> values. It is up to the caller to distinguish.
*
*
* @return Returns the values allowed
*/
private List<String> getAllowedValues()
{
List<ClassificationLevel> classificationLevels = classificationService.getClassificationLevels();
List<ClassificationLevel> classificationLevels = classificationSchemeService.getClassificationLevels();
List<String> values = new ArrayList<String>();
for (ClassificationLevel classificationLevel : classificationLevels)
{

View File

@@ -22,7 +22,7 @@ import java.util.ArrayList;
import java.util.List;
import com.google.common.collect.ImmutableList;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationServiceException.LevelIdNotFound;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationException.LevelIdNotFound;
/**
* Container for the configured {@link ClassificationLevel} objects.

View File

@@ -21,7 +21,7 @@ package org.alfresco.module.org_alfresco_module_rm.classification;
import java.util.Collection;
import com.google.common.collect.ImmutableList;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationServiceException.ReasonIdNotFound;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationException.ReasonIdNotFound;
/**
* Container for the configured {@link ClassificationReason} objects.

View File

@@ -20,18 +20,18 @@ package org.alfresco.module.org_alfresco_module_rm.classification;
import java.util.List;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationServiceException.LevelIdNotFound;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationServiceException.ReasonIdNotFound;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationException.LevelIdNotFound;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationException.ReasonIdNotFound;
/**
* The Classification Service supports the 'Classified Records' feature, whereby Alfresco
* content can be given a {@link ClassificationLevel}. This restricts access to that
* content to users having the appropriate security clearance.
* The Classification Scheme Service supports the 'Classified Records' feature, whereby Alfresco content can be given a
* {@link ClassificationLevel}. This restricts access to that content to users having the appropriate security
* clearance.
*
* @author Neil Mc Erlean
* @since 3.0
*/
public interface ClassificationService
public interface ClassificationSchemeService
{
/**
* Returns an immutable list of the defined classification levels visible to the current user.

View File

@@ -23,8 +23,8 @@ import static org.alfresco.module.org_alfresco_module_rm.util.RMParameterCheck.c
import java.util.Collections;
import java.util.List;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationServiceException.LevelIdNotFound;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationServiceException.ReasonIdNotFound;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationException.LevelIdNotFound;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationException.ReasonIdNotFound;
import org.alfresco.module.org_alfresco_module_rm.classification.model.ClassifiedContentModel;
import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl;
import org.alfresco.service.cmr.repository.NodeService;
@@ -33,8 +33,8 @@ import org.alfresco.service.cmr.repository.NodeService;
* @author Neil Mc Erlean
* @since 3.0
*/
public class ClassificationServiceImpl extends ServiceBaseImpl
implements ClassificationService, ClassifiedContentModel
public class ClassificationSchemeServiceImpl extends ServiceBaseImpl implements ClassificationSchemeService,
ClassifiedContentModel
{
/** The classification levels currently configured in this server. */
private ClassificationLevelManager levelManager;
@@ -94,7 +94,7 @@ public class ClassificationServiceImpl extends ServiceBaseImpl
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.classification.ClassificationService#getClassificationLevelById(java.lang.String)
* @see org.alfresco.module.org_alfresco_module_rm.classification.ClassificationSchemeService#getClassificationLevelById(java.lang.String)
*/
@Override
public ClassificationLevel getClassificationLevelById(String classificationLevelId) throws LevelIdNotFound
@@ -104,7 +104,7 @@ public class ClassificationServiceImpl extends ServiceBaseImpl
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.classification.ClassificationService#getClassificationReasonById(java.lang.String)
* @see org.alfresco.module.org_alfresco_module_rm.classification.ClassificationSchemeService#getClassificationReasonById(java.lang.String)
*/
@Override
public ClassificationReason getClassificationReasonById(String classificationReasonId) throws ReasonIdNotFound

View File

@@ -26,34 +26,34 @@ import org.slf4j.LoggerFactory;
/**
* A Spring class used to provide the {@link ClassificationService} to non-Spring classes.
*
* A Spring class used to provide the {@link ClassificationSchemeService} to non-Spring classes.
*
* @author tpage
*/
public class ClassificationServiceProvider
public class ClassificationSchemeServiceProvider
{
/** Logging utility for the class. */
private static final Logger LOGGER = LoggerFactory.getLogger(ClassificationServiceProvider.class);
private static final Logger LOGGER = LoggerFactory.getLogger(ClassificationSchemeServiceProvider.class);
/** The Spring application context. */
private static final AtomicReference<ClassificationService> CLASSIFICATION_SERVICE_REF = new AtomicReference<>();
private static final AtomicReference<ClassificationSchemeService> CLASSIFICATION_SCHEME_SERVICE_REF = new AtomicReference<>();
/** Constructor that takes the classification service and makes it available statically. */
public ClassificationServiceProvider(ClassificationService classificationService)
/** Constructor that takes the classification scheme service and makes it available statically. */
public ClassificationSchemeServiceProvider(ClassificationSchemeService classificationSchemeService)
{
ClassificationService oldClassificationService = CLASSIFICATION_SERVICE_REF.getAndSet(classificationService);
if (oldClassificationService != null)
ClassificationSchemeService oldClassificationSchemeService = CLASSIFICATION_SCHEME_SERVICE_REF.getAndSet(classificationSchemeService);
if (oldClassificationSchemeService != null)
{
LOGGER.debug("Unexpected instantiation of ClassificationServiceProvider has updated reference to classification service.");
LOGGER.debug("Unexpected instantiation of ClassificationSchemeServiceProvider has updated reference to classification scheme service.");
}
}
/**
* Get the <code>ClassificationService</code> as defined in the Spring context.
*
* Get the <code>ClassificationSchemeService</code> as defined in the Spring context.
*
* @return The service bean.
*/
public static ClassificationService getClassificationService()
public static ClassificationSchemeService getClassificationSchemeService()
{
return CLASSIFICATION_SERVICE_REF.get();
return CLASSIFICATION_SCHEME_SERVICE_REF.get();
}
}

View File

@@ -23,7 +23,7 @@ import java.util.ArrayList;
import java.util.List;
import com.google.common.collect.ImmutableList;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationServiceException.MissingConfiguration;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationException.MissingConfiguration;
import org.alfresco.module.org_alfresco_module_rm.classification.model.ClassifiedContentModel;
import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil;
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;

View File

@@ -24,7 +24,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationServiceException.MalformedConfiguration;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationException.MalformedConfiguration;
import org.apache.commons.io.IOUtils;
import org.json.JSONArray;
import org.json.JSONException;

View File

@@ -21,7 +21,7 @@ package org.alfresco.module.org_alfresco_module_rm.classification;
import java.util.List;
import com.google.common.collect.ImmutableList;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationServiceException.LevelIdNotFound;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationException.LevelIdNotFound;
/**
* Container for the configured {@link ClearanceLevel} objects.

View File

@@ -20,9 +20,9 @@ package org.alfresco.module.org_alfresco_module_rm.classification;
import java.util.Set;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationServiceException.InvalidNode;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationServiceException.LevelIdNotFound;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationServiceException.ReasonIdNotFound;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationException.InvalidNode;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationException.LevelIdNotFound;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationException.ReasonIdNotFound;
import org.alfresco.service.cmr.repository.InvalidNodeRefException;
import org.alfresco.service.cmr.repository.NodeRef;

View File

@@ -29,8 +29,8 @@ import java.util.Set;
import org.alfresco.model.ContentModel;
import org.alfresco.model.QuickShareModel;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationServiceException.InvalidNode;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationServiceException.LevelIdNotFound;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationException.InvalidNode;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationException.LevelIdNotFound;
import org.alfresco.module.org_alfresco_module_rm.classification.model.ClassifiedContentModel;
import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl;
import org.alfresco.service.cmr.dictionary.DictionaryService;

View File

@@ -25,7 +25,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationServiceException.LevelIdNotFound;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationException.LevelIdNotFound;
import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl;
import org.alfresco.query.PagingRequest;
import org.alfresco.query.PagingResults;

View File

@@ -22,7 +22,7 @@
* Nodes within Alfresco can be given a {@link org.alfresco.module.org_alfresco_module_rm.classification.ClassificationLevel}
* which then restricts access to them to users having the appropriate clearance.
* <p/>
* The {@link org.alfresco.module.org_alfresco_module_rm.classification.ClassificationService} is responsible
* The {@link org.alfresco.module.org_alfresco_module_rm.classification.ClassificationSchemeService} is responsible
* for the management of those levels and it is the
* {@link org.alfresco.module.org_alfresco_module_rm.classification.SecurityClearanceService} which deals
* wth users and their clearances.

View File

@@ -29,7 +29,7 @@ import java.util.Set;
import org.alfresco.model.ContentModel;
import org.alfresco.model.ImapModel;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationService;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationSchemeService;
import org.alfresco.module.org_alfresco_module_rm.classification.model.ClassifiedContentModel;
import org.alfresco.module.org_alfresco_module_rm.compatibility.CompatibilityModel;
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule;
@@ -85,8 +85,8 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
/** File Plan Service */
private FilePlanService filePlanService;
/** Classification Service */
private ClassificationService classificationService;
/** Classification Scheme Service */
private ClassificationSchemeService classificationSchemeService;
/**
* Returns the disposition service
@@ -109,13 +109,13 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
}
/**
* Returns the classification service
* Returns the classification scheme service
*
* @return Classification service
* @return Classification scheme service
*/
protected ClassificationService getClassificationService()
protected ClassificationSchemeService getClassificationSchemeService()
{
return this.classificationService;
return this.classificationSchemeService;
}
/**
@@ -133,15 +133,15 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
*/
public void setFilePlanService(FilePlanService filePlanService)
{
this.filePlanService = filePlanService;
}
this.filePlanService = filePlanService;
}
/**
* @param classificationService classification service
* @param classificationSchemeService classification scheme service
*/
public void setClassificationService(ClassificationService classificationService)
public void setClassificationSchemeService(ClassificationSchemeService classificationSchemeService)
{
this.classificationService = classificationService;
this.classificationSchemeService = classificationSchemeService;
}
/**
@@ -207,14 +207,14 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
String initialClassificationId = (String) nodeService.getProperty(nodeRef, ClassifiedContentModel.PROP_INITIAL_CLASSIFICATION);
if (isNotBlank(initialClassificationId))
{
String initialClassificationDisplayLabel = getClassificationService().getClassificationLevelById(initialClassificationId).getDisplayLabel();
String initialClassificationDisplayLabel = getClassificationSchemeService().getClassificationLevelById(initialClassificationId).getDisplayLabel();
addTransientPropertyField(form, TRANSIENT_INITIAL_CLASSIFICATION, DataTypeDefinition.TEXT, initialClassificationDisplayLabel);
}
String currentClassificationId = (String) nodeService.getProperty(nodeRef, ClassifiedContentModel.PROP_CURRENT_CLASSIFICATION);
if (isNotBlank(currentClassificationId))
{
String currentClassificationDisplayLabel = getClassificationService().getClassificationLevelById(currentClassificationId).getDisplayLabel();
String currentClassificationDisplayLabel = getClassificationSchemeService().getClassificationLevelById(currentClassificationId).getDisplayLabel();
addTransientPropertyField(form, TRANSIENT_CURRENT_CLASSIFICATION, DataTypeDefinition.TEXT, currentClassificationDisplayLabel);
}
@@ -227,7 +227,7 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
for (int i = 0; i < size; i++)
{
String id = classificationReasons.get(i);
String displayLabel = getClassificationService().getClassificationReasonById(id).getDisplayLabel();
String displayLabel = getClassificationSchemeService().getClassificationReasonById(id).getDisplayLabel();
classificationReasonLabels.add(id + ": " + displayLabel + (i < size - 1 ? "|": ""));
}
addTransientPropertyField(form, TRANSIENT_CLASSIFICATION_REASON_LABELS, DataTypeDefinition.TEXT, classificationReasonLabels);

View File

@@ -21,7 +21,7 @@ package org.alfresco.module.org_alfresco_module_rm.script.classification;
import java.util.HashMap;
import java.util.Map;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationService;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationSchemeService;
import org.alfresco.module.org_alfresco_module_rm.script.AbstractRmWebScript;
import org.springframework.extensions.webscripts.Cache;
import org.springframework.extensions.webscripts.Status;
@@ -38,17 +38,17 @@ public class ClassificationLevelsGet extends AbstractRmWebScript
/** Constants */
private static final String LEVELS = "levels";
/** Classification service */
private ClassificationService classificationService;
/** Classification scheme service */
private ClassificationSchemeService classificationSchemeService;
/**
* Sets the classification service
* Sets the classification scheme service
*
* @param classificatonService The classification service
* @param classificationSchemeService The classification scheme service
*/
public void setClassificationService(ClassificationService classificationService)
public void setClassificationService(ClassificationSchemeService classificationSchemeService)
{
this.classificationService = classificationService;
this.classificationSchemeService = classificationSchemeService;
}
/**
@@ -60,7 +60,7 @@ public class ClassificationLevelsGet extends AbstractRmWebScript
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache)
{
Map<String, Object> result = new HashMap<String, Object>();
result.put(LEVELS, classificationService.getClassificationLevels());
result.put(LEVELS, classificationSchemeService.getClassificationLevels());
return result;
}
}

View File

@@ -21,7 +21,7 @@ package org.alfresco.module.org_alfresco_module_rm.script.classification;
import java.util.HashMap;
import java.util.Map;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationService;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationSchemeService;
import org.alfresco.module.org_alfresco_module_rm.script.AbstractRmWebScript;
import org.springframework.extensions.webscripts.Cache;
import org.springframework.extensions.webscripts.Status;
@@ -38,17 +38,17 @@ public class ReasonsGet extends AbstractRmWebScript
/** Constants */
private static final String REASONS = "reasons";
/** Classification service */
private ClassificationService classificationService;
/** Classification scheme service */
private ClassificationSchemeService classificationSchemeService;
/**
* Sets the classification service
* Sets the classification scheme service
*
* @param classificatonService The classification service
* @param classificationSchemeService The classification scheme service
*/
public void setClassificationService(ClassificationService classificationService)
public void setClassificationService(ClassificationSchemeService classificationSchemeService)
{
this.classificationService = classificationService;
this.classificationSchemeService = classificationSchemeService;
}
/**
@@ -60,7 +60,7 @@ public class ReasonsGet extends AbstractRmWebScript
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache)
{
Map<String, Object> result = new HashMap<String, Object>();
result.put(REASONS, classificationService.getClassificationReasons());
result.put(REASONS, classificationSchemeService.getClassificationReasons());
return result;
}
}

View File

@@ -18,7 +18,7 @@
*/
package org.alfresco.module.org_alfresco_module_rm.script.classification;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationServiceException;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationException;
import org.alfresco.module.org_alfresco_module_rm.classification.SecurityClearance;
import org.alfresco.module.org_alfresco_module_rm.classification.SecurityClearanceService;
import org.alfresco.module.org_alfresco_module_rm.script.AbstractRmWebScript;
@@ -72,7 +72,7 @@ public class UserSecurityClearancePut extends AbstractRmWebScript
securityClearance = securityClearanceService.setUserSecurityClearance(username,
clearanceId);
}
catch (ClassificationServiceException.LevelIdNotFound exception)
catch (ClassificationException.LevelIdNotFound exception)
{
throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Unable to find clearance level");
}