mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
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:
@@ -35,32 +35,32 @@
|
||||
<property name="reasonConfigLocation" value="${rm.classification.reasonsFile}" />
|
||||
</bean>
|
||||
|
||||
<!-- Classification Service -->
|
||||
<!-- Classification Scheme Service -->
|
||||
|
||||
<bean id="classificationService"
|
||||
class="org.alfresco.module.org_alfresco_module_rm.classification.ClassificationServiceImpl"
|
||||
<bean id="classificationSchemeService"
|
||||
class="org.alfresco.module.org_alfresco_module_rm.classification.ClassificationSchemeServiceImpl"
|
||||
parent="baseService" init-method="init">
|
||||
<property name="classificationServiceBootstrap" ref="classificationServiceBootstrap"/>
|
||||
<property name="securityClearanceService" ref="securityClearanceService"/>
|
||||
</bean>
|
||||
|
||||
<bean id="ClassificationService" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||
<bean id="ClassificationSchemeService" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||
<property name="proxyInterfaces">
|
||||
<value>org.alfresco.module.org_alfresco_module_rm.classification.ClassificationService</value>
|
||||
<value>org.alfresco.module.org_alfresco_module_rm.classification.ClassificationSchemeService</value>
|
||||
</property>
|
||||
<property name="target">
|
||||
<ref bean="classificationService"/>
|
||||
<ref bean="classificationSchemeService"/>
|
||||
</property>
|
||||
<property name="interceptorNames">
|
||||
<list>
|
||||
<idref local="ClassificationService_transaction"/>
|
||||
<idref local="ClassificationSchemeService_transaction"/>
|
||||
<idref bean="exceptionTranslator"/>
|
||||
<idref local="ClassificationService_security"/>
|
||||
<idref local="ClassificationSchemeService_security"/>
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="ClassificationService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor">
|
||||
<bean id="ClassificationSchemeService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor">
|
||||
<property name="transactionManager">
|
||||
<ref bean="transactionManager"/>
|
||||
</property>
|
||||
@@ -71,22 +71,22 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<!-- FIXME: We have to restrict methods in the classification service (with capabilities, etc.) -->
|
||||
<bean id="ClassificationService_security" parent="baseSecurity">
|
||||
<!-- FIXME: We have to restrict methods in the classification scheme service (with capabilities, etc.) -->
|
||||
<bean id="ClassificationSchemeService_security" parent="baseSecurity">
|
||||
<property name="objectDefinitionSource">
|
||||
<value>
|
||||
org.alfresco.module.org_alfresco_module_rm.classification.ClassificationService.getClassificationLevels=ACL_ALLOW
|
||||
org.alfresco.module.org_alfresco_module_rm.classification.ClassificationService.getClassificationReasons=ACL_ALLOW
|
||||
org.alfresco.module.org_alfresco_module_rm.classification.ClassificationService.getClassificationLevelById=ACL_ALLOW
|
||||
org.alfresco.module.org_alfresco_module_rm.classification.ClassificationService.getClassificationReasonById=ACL_ALLOW
|
||||
org.alfresco.module.org_alfresco_module_rm.classification.ClassificationService.getUnclassifiedClassificationLevel=ACL_ALLOW
|
||||
org.alfresco.module.org_alfresco_module_rm.classification.ClassificationService.*=ACL_DENY
|
||||
org.alfresco.module.org_alfresco_module_rm.classification.ClassificationSchemeService.getClassificationLevels=ACL_ALLOW
|
||||
org.alfresco.module.org_alfresco_module_rm.classification.ClassificationSchemeService.getClassificationReasons=ACL_ALLOW
|
||||
org.alfresco.module.org_alfresco_module_rm.classification.ClassificationSchemeService.getClassificationLevelById=ACL_ALLOW
|
||||
org.alfresco.module.org_alfresco_module_rm.classification.ClassificationSchemeService.getClassificationReasonById=ACL_ALLOW
|
||||
org.alfresco.module.org_alfresco_module_rm.classification.ClassificationSchemeService.getUnclassifiedClassificationLevel=ACL_ALLOW
|
||||
org.alfresco.module.org_alfresco_module_rm.classification.ClassificationSchemeService.*=ACL_DENY
|
||||
</value>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="ClassificationServiceProvider" class="org.alfresco.module.org_alfresco_module_rm.classification.ClassificationServiceProvider">
|
||||
<constructor-arg ref="ClassificationService" index="0" />
|
||||
<bean id="ClassificationSchemeServiceProvider" class="org.alfresco.module.org_alfresco_module_rm.classification.ClassificationSchemeServiceProvider">
|
||||
<constructor-arg ref="ClassificationSchemeService" index="0" />
|
||||
</bean>
|
||||
|
||||
<bean id="classificationServiceBootstrap"
|
||||
|
@@ -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;
|
@@ -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
|
||||
@@ -64,7 +64,7 @@ public class ClassificationLevelConstraint extends AbstractConstraint
|
||||
*/
|
||||
private List<String> getAllowedValues()
|
||||
{
|
||||
List<ClassificationLevel> classificationLevels = classificationService.getClassificationLevels();
|
||||
List<ClassificationLevel> classificationLevels = classificationSchemeService.getClassificationLevels();
|
||||
List<String> values = new ArrayList<String>();
|
||||
for (ClassificationLevel classificationLevel : classificationLevels)
|
||||
{
|
||||
|
@@ -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.
|
||||
|
@@ -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.
|
||||
|
@@ -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.
|
@@ -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
|
@@ -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();
|
||||
}
|
||||
}
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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.
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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.
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -137,11 +137,11 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
|
||||
}
|
||||
|
||||
/**
|
||||
* @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);
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -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");
|
||||
}
|
||||
|
@@ -62,7 +62,7 @@ public class ClassificationLevelsTest extends BaseRMTestCase
|
||||
|
||||
public void then() throws Exception
|
||||
{
|
||||
List<ClassificationLevel> levels = classificationService.getClassificationLevels();
|
||||
List<ClassificationLevel> levels = classificationSchemeService.getClassificationLevels();
|
||||
assertNotNull(levels);
|
||||
assertEquals("Expected 5 levels to be configured (4 defined in the test plus Unclassified)", 5, levels.size());
|
||||
|
||||
|
@@ -22,7 +22,7 @@ package org.alfresco.module.org_alfresco_module_rm.test.integration.classificati
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationReason;
|
||||
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationServiceImpl;
|
||||
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationSchemeServiceImpl;
|
||||
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
|
||||
|
||||
/**
|
||||
@@ -34,13 +34,12 @@ import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
|
||||
public class ClassificationReasonsTest extends BaseRMTestCase
|
||||
{
|
||||
/**
|
||||
* Given the default classification reasons config file is on the classpath
|
||||
* When the system has finished starting up
|
||||
* Given the default classification reasons config file is on the classpath When the system has finished starting up
|
||||
* Then the classification service exposes the classification reasons.
|
||||
* <p>
|
||||
* Note that this test requires a clean db, as otherwise the classification service will use the persisted
|
||||
* classification reasons in preference to those given on the classpath (see the logic in {@link
|
||||
* ClassificationServiceImpl#initConfiguredClassificationReasons()}).
|
||||
* Note that this test requires a clean db, as otherwise the classification scheme service will use the persisted
|
||||
* classification reasons in preference to those given on the classpath (see the logic in
|
||||
* {@link ClassificationSchemeServiceImpl#initConfiguredClassificationReasons()}).
|
||||
*/
|
||||
public void testLoadBootstrappedClassificationReasons() throws Exception
|
||||
{
|
||||
@@ -58,8 +57,8 @@ public class ClassificationReasonsTest extends BaseRMTestCase
|
||||
|
||||
public void then() throws Exception
|
||||
{
|
||||
// Check the classification service exposes the classification reasons.
|
||||
List<ClassificationReason> reasons = classificationService.getClassificationReasons();
|
||||
// Check the classification scheme service exposes the classification reasons.
|
||||
List<ClassificationReason> reasons = classificationSchemeService.getClassificationReasons();
|
||||
assertNotNull(reasons);
|
||||
assertEquals("The default classification reasons in test/resources/alfresco/module/"
|
||||
+ "org_alfresco_module_rm/classification/rm-classification-reasons.json "
|
||||
|
@@ -22,7 +22,7 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
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.classification.model.ClassifiedContentModel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
|
||||
|
@@ -19,7 +19,7 @@
|
||||
package org.alfresco.module.org_alfresco_module_rm.test.integration.classification;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationLevel;
|
||||
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.classification.ClearanceLevel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.classification.SecurityClearance;
|
||||
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
|
||||
|
@@ -29,7 +29,7 @@ import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminSe
|
||||
import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel;
|
||||
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.ContentClassificationService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.classification.SecurityClearanceService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.dataset.DataSetService;
|
||||
@@ -163,7 +163,7 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
|
||||
protected HoldService holdService;
|
||||
protected InplaceRecordService inplaceRecordService;
|
||||
protected RelationshipService relationshipService;
|
||||
protected ClassificationService classificationService;
|
||||
protected ClassificationSchemeService classificationSchemeService;
|
||||
protected SecurityClearanceService securityClearanceService;
|
||||
protected ContentClassificationService contentClassificationService;
|
||||
|
||||
@@ -405,7 +405,7 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
|
||||
holdService = (HoldService) applicationContext.getBean("HoldService");
|
||||
inplaceRecordService = (InplaceRecordService) applicationContext.getBean("InplaceRecordService");
|
||||
relationshipService = (RelationshipService) applicationContext.getBean("RelationshipService");
|
||||
classificationService = (ClassificationService) applicationContext.getBean("ClassificationService");
|
||||
classificationSchemeService = (ClassificationSchemeService) applicationContext.getBean("ClassificationSchemeService");
|
||||
securityClearanceService = (SecurityClearanceService) applicationContext.getBean("SecurityClearanceService");
|
||||
contentClassificationService = (ContentClassificationService) applicationContext.getBean("ContentClassificationService");
|
||||
}
|
||||
|
@@ -42,7 +42,7 @@ public class ClassificationLevelConstraintUnitTest
|
||||
private static final List<ClassificationLevel> DEFAULT_LEVELS = Arrays.asList(LEVEL_ONE, LEVEL_TWO);
|
||||
|
||||
@InjectMocks ClassificationLevelConstraint classificationLevelConstraint;
|
||||
@Mock ClassificationService mockClassificationService;
|
||||
@Mock ClassificationSchemeService mockClassificationSchemeService;
|
||||
|
||||
@Before
|
||||
public void setUp()
|
||||
@@ -50,7 +50,7 @@ public class ClassificationLevelConstraintUnitTest
|
||||
MockitoAnnotations.initMocks(this);
|
||||
|
||||
// Currently this list of levels suffices for all the tests.
|
||||
doReturn(DEFAULT_LEVELS).when(mockClassificationService).getClassificationLevels();
|
||||
doReturn(DEFAULT_LEVELS).when(mockClassificationSchemeService).getClassificationLevels();
|
||||
}
|
||||
|
||||
/** Check that evaluateSingleValue throws no exceptions when an id is found. */
|
||||
|
@@ -23,7 +23,7 @@ import static org.junit.Assert.assertEquals;
|
||||
import java.util.Arrays;
|
||||
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.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
|
@@ -23,7 +23,7 @@ import static org.junit.Assert.assertEquals;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationServiceException.ReasonIdNotFound;
|
||||
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationException.ReasonIdNotFound;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
|
@@ -27,8 +27,8 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
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.test.util.ExceptionUtils;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
@@ -42,12 +42,12 @@ import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link ClassificationServiceImpl}.
|
||||
* Unit tests for {@link ClassificationSchemeServiceImpl}.
|
||||
*
|
||||
* @author Neil Mc Erlean
|
||||
* @since 3.0
|
||||
*/
|
||||
public class ClassificationServiceImplUnitTest
|
||||
public class ClassificationSchemeServiceImplUnitTest
|
||||
{
|
||||
private static final List<ClassificationLevel> DEFAULT_CLASSIFICATION_LEVELS = asLevelList("Top Secret", "rm.classification.topSecret",
|
||||
"Secret", "rm.classification.secret",
|
||||
@@ -78,7 +78,7 @@ public class ClassificationServiceImplUnitTest
|
||||
return levels;
|
||||
}
|
||||
|
||||
@InjectMocks private ClassificationServiceImpl classificationServiceImpl;
|
||||
@InjectMocks private ClassificationSchemeServiceImpl classificationSchemeServiceImpl;
|
||||
|
||||
@Mock private NodeService mockNodeService;
|
||||
@Mock private DictionaryService mockDictionaryService;
|
||||
@@ -99,7 +99,7 @@ public class ClassificationServiceImplUnitTest
|
||||
{
|
||||
ClassificationLevel targetLevel = new ClassificationLevel("Secret", "rm.classification.secret");
|
||||
|
||||
List<ClassificationLevel> actual = classificationServiceImpl.restrictList(DEFAULT_CLASSIFICATION_LEVELS, targetLevel);
|
||||
List<ClassificationLevel> actual = classificationSchemeServiceImpl.restrictList(DEFAULT_CLASSIFICATION_LEVELS, targetLevel);
|
||||
|
||||
List<ClassificationLevel> expected = asLevelList("Secret", "rm.classification.secret",
|
||||
"Confidential", "rm.classification.confidential",
|
||||
@@ -116,7 +116,7 @@ public class ClassificationServiceImplUnitTest
|
||||
{
|
||||
ClassificationLevel targetLevel = new ClassificationLevel("UnrecognisedLevel", "rm.classification.IMadeThisUp");
|
||||
|
||||
List<ClassificationLevel> actual = classificationServiceImpl.restrictList(DEFAULT_CLASSIFICATION_LEVELS, targetLevel);
|
||||
List<ClassificationLevel> actual = classificationSchemeServiceImpl.restrictList(DEFAULT_CLASSIFICATION_LEVELS, targetLevel);
|
||||
|
||||
assertEquals("Expected an empty list when the target level is not found.", 0, actual.size());
|
||||
}
|
||||
@@ -127,7 +127,7 @@ public class ClassificationServiceImplUnitTest
|
||||
String levelId = "classificationLevelId1";
|
||||
ClassificationLevel classificationLevel = new ClassificationLevel(levelId, "displayLabelKey");
|
||||
when(mockLevelManager.findLevelById(levelId)).thenReturn(classificationLevel);
|
||||
ClassificationLevel classificationLevelById = classificationServiceImpl.getClassificationLevelById(levelId);
|
||||
ClassificationLevel classificationLevelById = classificationSchemeServiceImpl.getClassificationLevelById(levelId);
|
||||
assertEquals(classificationLevel, classificationLevelById);
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ public class ClassificationServiceImplUnitTest
|
||||
{
|
||||
String classificationLevelId = "aRandomId";
|
||||
doThrow(new LevelIdNotFound("Id not found!")).when(mockLevelManager).findLevelById(classificationLevelId);
|
||||
classificationServiceImpl.getClassificationLevelById(classificationLevelId);
|
||||
classificationSchemeServiceImpl.getClassificationLevelById(classificationLevelId);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -145,7 +145,7 @@ public class ClassificationServiceImplUnitTest
|
||||
String reasonId = "classificationReasonId1";
|
||||
ClassificationReason classificationReason = new ClassificationReason(reasonId, "displayLabelKey");
|
||||
when(mockReasonManager.findReasonById(reasonId)).thenReturn(classificationReason);
|
||||
ClassificationReason classificationReasonById = classificationServiceImpl.getClassificationReasonById(reasonId);
|
||||
ClassificationReason classificationReasonById = classificationSchemeServiceImpl.getClassificationReasonById(reasonId);
|
||||
assertEquals(classificationReason, classificationReasonById);
|
||||
}
|
||||
|
||||
@@ -154,6 +154,6 @@ public class ClassificationServiceImplUnitTest
|
||||
{
|
||||
String classificationReasonId = "aRandomId";
|
||||
doThrow(new ReasonIdNotFound("Id not found!")).when(mockReasonManager).findReasonById(classificationReasonId);
|
||||
classificationServiceImpl.getClassificationReasonById(classificationReasonId);
|
||||
classificationSchemeServiceImpl.getClassificationReasonById(classificationReasonId);
|
||||
}
|
||||
}
|
@@ -35,7 +35,7 @@ import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
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.test.util.MockAuthenticationUtilHelper;
|
||||
import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil;
|
||||
import org.alfresco.service.cmr.attributes.AttributeService;
|
||||
|
@@ -18,14 +18,14 @@
|
||||
*/
|
||||
package org.alfresco.module.org_alfresco_module_rm.classification;
|
||||
|
||||
import static org.alfresco.module.org_alfresco_module_rm.classification.ClassificationServiceImplUnitTest.asLevelList;
|
||||
import static org.alfresco.module.org_alfresco_module_rm.classification.ClassificationSchemeServiceImplUnitTest.asLevelList;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
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.junit.Test;
|
||||
|
||||
/**
|
||||
|
@@ -23,7 +23,7 @@ import static org.junit.Assert.assertEquals;
|
||||
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;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
|
@@ -42,8 +42,8 @@ import com.google.common.collect.Sets;
|
||||
|
||||
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.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
|
@@ -31,7 +31,7 @@ import static org.mockito.Mockito.when;
|
||||
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;
|
||||
import org.alfresco.module.org_alfresco_module_rm.test.util.MockAuthenticationUtilHelper;
|
||||
import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
@@ -62,7 +62,7 @@ public class SecurityClearanceServiceImplUnitTest
|
||||
@Mock private DictionaryService mockDictionaryService;
|
||||
@Mock private NodeService mockNodeService;
|
||||
@Mock private PersonService mockPersonService;
|
||||
@Mock private ClassificationService mockClassificationService;
|
||||
@Mock private ClassificationSchemeService mockClassificationSchemeService;
|
||||
@Mock private ClearanceLevelManager mockClearanceLevelManager;
|
||||
@Mock private ClassificationLevelComparator mockClassificationLevelComparator;
|
||||
|
||||
@@ -95,7 +95,7 @@ public class SecurityClearanceServiceImplUnitTest
|
||||
{
|
||||
final PersonInfo user1 = createMockPerson("user1", "User", "One", null);
|
||||
MockAuthenticationUtilHelper.setup(mockAuthenticationUtil, user1.getUserName());
|
||||
when(mockClassificationService.getUnclassifiedClassificationLevel())
|
||||
when(mockClassificationSchemeService.getUnclassifiedClassificationLevel())
|
||||
.thenReturn(ClassificationLevelManager.UNCLASSIFIED);
|
||||
when(mockClearanceLevelManager.findLevelByClassificationLevelId(ClassificationLevelManager.UNCLASSIFIED_ID))
|
||||
.thenReturn(ClearanceLevelManager.NO_CLEARANCE);
|
||||
|
@@ -28,7 +28,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationLevel;
|
||||
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.test.util.BaseWebScriptUnitTest;
|
||||
import org.json.JSONObject;
|
||||
import org.junit.Test;
|
||||
@@ -53,7 +53,7 @@ public class ClassificationLevelsGetUnitTest extends BaseWebScriptUnitTest
|
||||
|
||||
/** ClassificationLevelsGet webscript instance */
|
||||
private @Spy @InjectMocks ClassificationLevelsGet webScript;
|
||||
private @Mock ClassificationService mockClassificationService;
|
||||
private @Mock ClassificationSchemeService mockClassificationSchemeService;
|
||||
|
||||
private List<ClassificationLevel> classificationLevels;
|
||||
|
||||
@@ -83,7 +83,7 @@ public class ClassificationLevelsGetUnitTest extends BaseWebScriptUnitTest
|
||||
new ClassificationLevel("id2", "labelKey2"));
|
||||
|
||||
// setup interactions
|
||||
doReturn(classificationLevels).when(mockClassificationService).getClassificationLevels();
|
||||
doReturn(classificationLevels).when(mockClassificationSchemeService).getClassificationLevels();
|
||||
|
||||
// execute web script
|
||||
JSONObject json = executeJSONWebScript(new HashMap<String, String>());
|
||||
|
@@ -29,7 +29,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationReason;
|
||||
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.test.util.BaseWebScriptUnitTest;
|
||||
import org.json.JSONObject;
|
||||
import org.junit.Test;
|
||||
@@ -53,7 +53,7 @@ public class ReasonsGetUnitTest extends BaseWebScriptUnitTest
|
||||
|
||||
/** ReasonsGet webscript instance */
|
||||
private @Spy @InjectMocks ReasonsGet webScript;
|
||||
private @Mock ClassificationService mockClassificationService;
|
||||
private @Mock ClassificationSchemeService mockClassificationSchemeService;
|
||||
|
||||
private List<ClassificationReason> reasonsList;
|
||||
|
||||
@@ -83,7 +83,7 @@ public class ReasonsGetUnitTest extends BaseWebScriptUnitTest
|
||||
reasonsList = Arrays.asList(reasonA, reasonB);
|
||||
|
||||
// setup interactions
|
||||
doReturn(reasonsList).when(mockClassificationService).getClassificationReasons();
|
||||
doReturn(reasonsList).when(mockClassificationSchemeService).getClassificationReasons();
|
||||
|
||||
// setup web script parameters
|
||||
Map<String, String> parameters = new HashMap<String, String>();
|
||||
|
@@ -10,7 +10,7 @@ import java.util.Map;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationLevel;
|
||||
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.ClearanceLevel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.classification.SecurityClearance;
|
||||
import org.alfresco.module.org_alfresco_module_rm.classification.SecurityClearanceService;
|
||||
@@ -114,7 +114,7 @@ public class UserSecurityClearancePutUnitTest extends BaseWebScriptUnitTest
|
||||
Map<String, String> parameters = buildParameters(USERNAME, username, CLEARANCE_ID, clearanceId);
|
||||
|
||||
when(mockSecurityClearanceService.setUserSecurityClearance(username, clearanceId))
|
||||
.thenThrow(new ClassificationServiceException.LevelIdNotFound(clearanceId));
|
||||
.thenThrow(new ClassificationException.LevelIdNotFound(clearanceId));
|
||||
|
||||
// Execute web script - this should throw the expected exception.
|
||||
executeJSONWebScript(parameters);
|
||||
@@ -135,7 +135,7 @@ public class UserSecurityClearancePutUnitTest extends BaseWebScriptUnitTest
|
||||
Map<String, String> parameters = buildParameters(USERNAME, username, CLEARANCE_ID, clearanceId);
|
||||
|
||||
when(mockSecurityClearanceService.setUserSecurityClearance(username, clearanceId)).thenThrow(
|
||||
new ClassificationServiceException.LevelIdNotFound(clearanceId));
|
||||
new ClassificationException.LevelIdNotFound(clearanceId));
|
||||
|
||||
try
|
||||
{
|
||||
|
Reference in New Issue
Block a user