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}" />
|
<property name="reasonConfigLocation" value="${rm.classification.reasonsFile}" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<!-- Classification Service -->
|
<!-- Classification Scheme Service -->
|
||||||
|
|
||||||
<bean id="classificationService"
|
<bean id="classificationSchemeService"
|
||||||
class="org.alfresco.module.org_alfresco_module_rm.classification.ClassificationServiceImpl"
|
class="org.alfresco.module.org_alfresco_module_rm.classification.ClassificationSchemeServiceImpl"
|
||||||
parent="baseService" init-method="init">
|
parent="baseService" init-method="init">
|
||||||
<property name="classificationServiceBootstrap" ref="classificationServiceBootstrap"/>
|
<property name="classificationServiceBootstrap" ref="classificationServiceBootstrap"/>
|
||||||
<property name="securityClearanceService" ref="securityClearanceService"/>
|
<property name="securityClearanceService" ref="securityClearanceService"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="ClassificationService" class="org.springframework.aop.framework.ProxyFactoryBean">
|
<bean id="ClassificationSchemeService" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||||
<property name="proxyInterfaces">
|
<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>
|
||||||
<property name="target">
|
<property name="target">
|
||||||
<ref bean="classificationService"/>
|
<ref bean="classificationSchemeService"/>
|
||||||
</property>
|
</property>
|
||||||
<property name="interceptorNames">
|
<property name="interceptorNames">
|
||||||
<list>
|
<list>
|
||||||
<idref local="ClassificationService_transaction"/>
|
<idref local="ClassificationSchemeService_transaction"/>
|
||||||
<idref bean="exceptionTranslator"/>
|
<idref bean="exceptionTranslator"/>
|
||||||
<idref local="ClassificationService_security"/>
|
<idref local="ClassificationSchemeService_security"/>
|
||||||
</list>
|
</list>
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="ClassificationService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor">
|
<bean id="ClassificationSchemeService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor">
|
||||||
<property name="transactionManager">
|
<property name="transactionManager">
|
||||||
<ref bean="transactionManager"/>
|
<ref bean="transactionManager"/>
|
||||||
</property>
|
</property>
|
||||||
@@ -71,22 +71,22 @@
|
|||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<!-- FIXME: We have to restrict methods in the classification service (with capabilities, etc.) -->
|
<!-- FIXME: We have to restrict methods in the classification scheme service (with capabilities, etc.) -->
|
||||||
<bean id="ClassificationService_security" parent="baseSecurity">
|
<bean id="ClassificationSchemeService_security" parent="baseSecurity">
|
||||||
<property name="objectDefinitionSource">
|
<property name="objectDefinitionSource">
|
||||||
<value>
|
<value>
|
||||||
org.alfresco.module.org_alfresco_module_rm.classification.ClassificationService.getClassificationLevels=ACL_ALLOW
|
org.alfresco.module.org_alfresco_module_rm.classification.ClassificationSchemeService.getClassificationLevels=ACL_ALLOW
|
||||||
org.alfresco.module.org_alfresco_module_rm.classification.ClassificationService.getClassificationReasons=ACL_ALLOW
|
org.alfresco.module.org_alfresco_module_rm.classification.ClassificationSchemeService.getClassificationReasons=ACL_ALLOW
|
||||||
org.alfresco.module.org_alfresco_module_rm.classification.ClassificationService.getClassificationLevelById=ACL_ALLOW
|
org.alfresco.module.org_alfresco_module_rm.classification.ClassificationSchemeService.getClassificationLevelById=ACL_ALLOW
|
||||||
org.alfresco.module.org_alfresco_module_rm.classification.ClassificationService.getClassificationReasonById=ACL_ALLOW
|
org.alfresco.module.org_alfresco_module_rm.classification.ClassificationSchemeService.getClassificationReasonById=ACL_ALLOW
|
||||||
org.alfresco.module.org_alfresco_module_rm.classification.ClassificationService.getUnclassifiedClassificationLevel=ACL_ALLOW
|
org.alfresco.module.org_alfresco_module_rm.classification.ClassificationSchemeService.getUnclassifiedClassificationLevel=ACL_ALLOW
|
||||||
org.alfresco.module.org_alfresco_module_rm.classification.ClassificationService.*=ACL_DENY
|
org.alfresco.module.org_alfresco_module_rm.classification.ClassificationSchemeService.*=ACL_DENY
|
||||||
</value>
|
</value>
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="ClassificationServiceProvider" class="org.alfresco.module.org_alfresco_module_rm.classification.ClassificationServiceProvider">
|
<bean id="ClassificationSchemeServiceProvider" class="org.alfresco.module.org_alfresco_module_rm.classification.ClassificationSchemeServiceProvider">
|
||||||
<constructor-arg ref="ClassificationService" index="0" />
|
<constructor-arg ref="ClassificationSchemeService" index="0" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="classificationServiceBootstrap"
|
<bean id="classificationServiceBootstrap"
|
||||||
|
@@ -22,21 +22,21 @@ import org.alfresco.error.AlfrescoRuntimeException;
|
|||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
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
|
* @author Neil Mc Erlean
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public class ClassificationServiceException extends AlfrescoRuntimeException
|
public class ClassificationException extends AlfrescoRuntimeException
|
||||||
{
|
{
|
||||||
/** serial version uid */
|
/** serial version uid */
|
||||||
private static final long serialVersionUID = -7097573558438226725L;
|
private static final long serialVersionUID = -7097573558438226725L;
|
||||||
|
|
||||||
public ClassificationServiceException(String msgId) { super(msgId); }
|
public ClassificationException(String msgId) { super(msgId); }
|
||||||
public ClassificationServiceException(String msgId, Throwable cause) { super(msgId, cause); }
|
public ClassificationException(String msgId, Throwable cause) { super(msgId, cause); }
|
||||||
|
|
||||||
/** Represents a fatal error due to missing required configuration. */
|
/** Represents a fatal error due to missing required configuration. */
|
||||||
public static class MissingConfiguration extends ClassificationServiceException
|
public static class MissingConfiguration extends ClassificationException
|
||||||
{
|
{
|
||||||
/** serial version uid */
|
/** serial version uid */
|
||||||
private static final long serialVersionUID = -750162955179494445L;
|
private static final long serialVersionUID = -750162955179494445L;
|
||||||
@@ -46,7 +46,7 @@ public class ClassificationServiceException extends AlfrescoRuntimeException
|
|||||||
|
|
||||||
/** Represents a fatal error due to illegal configuration.
|
/** Represents a fatal error due to illegal configuration.
|
||||||
* The configuration was understood by the server, but was rejected as illegal. */
|
* 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 */
|
/** serial version uid */
|
||||||
private static final long serialVersionUID = -1139626996782741741L;
|
private static final long serialVersionUID = -1139626996782741741L;
|
||||||
@@ -56,7 +56,7 @@ public class ClassificationServiceException extends AlfrescoRuntimeException
|
|||||||
|
|
||||||
/** Represents a fatal error due to malformed configuration.
|
/** Represents a fatal error due to malformed configuration.
|
||||||
* The configuration could not be understood by the server. */
|
* The configuration could not be understood by the server. */
|
||||||
public static class MalformedConfiguration extends ClassificationServiceException
|
public static class MalformedConfiguration extends ClassificationException
|
||||||
{
|
{
|
||||||
/** serial version uid */
|
/** serial version uid */
|
||||||
private static final long serialVersionUID = 8191162359241035026L;
|
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. */
|
/** 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 */
|
/** serial version uid */
|
||||||
private static final long serialVersionUID = -8507186704795004383L;
|
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. */
|
/** 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 */
|
/** serial version uid */
|
||||||
private static final long serialVersionUID = -643842413653375433L;
|
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 */
|
/** serial version uid */
|
||||||
private static final long serialVersionUID = -4485335425932302477L;
|
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;
|
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
|
* @author tpage
|
||||||
*/
|
*/
|
||||||
public class ClassificationLevelConstraint extends AbstractConstraint
|
public class ClassificationLevelConstraint extends AbstractConstraint
|
||||||
{
|
{
|
||||||
/** The classification service provides access to the valid classification levels. */
|
/** The classification scheme service provides access to the valid classification levels. */
|
||||||
private ClassificationService classificationService;
|
private ClassificationSchemeService classificationSchemeService;
|
||||||
|
|
||||||
/** Constraints must use a default constructor. */
|
/** Constraints must use a default constructor. */
|
||||||
public ClassificationLevelConstraint()
|
public ClassificationLevelConstraint()
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
this.classificationService = ClassificationServiceProvider.getClassificationService();
|
this.classificationSchemeService = ClassificationSchemeServiceProvider.getClassificationSchemeService();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -59,12 +59,12 @@ public class ClassificationLevelConstraint extends AbstractConstraint
|
|||||||
/**
|
/**
|
||||||
* Get the allowed values. Note that these are <tt>String</tt> instances, but may
|
* 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.
|
* represent non-<tt>String</tt> values. It is up to the caller to distinguish.
|
||||||
*
|
*
|
||||||
* @return Returns the values allowed
|
* @return Returns the values allowed
|
||||||
*/
|
*/
|
||||||
private List<String> getAllowedValues()
|
private List<String> getAllowedValues()
|
||||||
{
|
{
|
||||||
List<ClassificationLevel> classificationLevels = classificationService.getClassificationLevels();
|
List<ClassificationLevel> classificationLevels = classificationSchemeService.getClassificationLevels();
|
||||||
List<String> values = new ArrayList<String>();
|
List<String> values = new ArrayList<String>();
|
||||||
for (ClassificationLevel classificationLevel : classificationLevels)
|
for (ClassificationLevel classificationLevel : classificationLevels)
|
||||||
{
|
{
|
||||||
|
@@ -22,7 +22,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
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.
|
* 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 java.util.Collection;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
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.
|
* 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 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.classification.ClassificationServiceException.ReasonIdNotFound;
|
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationException.ReasonIdNotFound;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Classification Service supports the 'Classified Records' feature, whereby Alfresco
|
* The Classification Scheme Service supports the 'Classified Records' feature, whereby Alfresco content can be given a
|
||||||
* content can be given a {@link ClassificationLevel}. This restricts access to that
|
* {@link ClassificationLevel}. This restricts access to that content to users having the appropriate security
|
||||||
* content to users having the appropriate security clearance.
|
* clearance.
|
||||||
*
|
*
|
||||||
* @author Neil Mc Erlean
|
* @author Neil Mc Erlean
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public interface ClassificationService
|
public interface ClassificationSchemeService
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Returns an immutable list of the defined classification levels visible to the current user.
|
* 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.Collections;
|
||||||
import java.util.List;
|
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.classification.ClassificationServiceException.ReasonIdNotFound;
|
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.classification.model.ClassifiedContentModel;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl;
|
import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
@@ -33,8 +33,8 @@ import org.alfresco.service.cmr.repository.NodeService;
|
|||||||
* @author Neil Mc Erlean
|
* @author Neil Mc Erlean
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public class ClassificationServiceImpl extends ServiceBaseImpl
|
public class ClassificationSchemeServiceImpl extends ServiceBaseImpl implements ClassificationSchemeService,
|
||||||
implements ClassificationService, ClassifiedContentModel
|
ClassifiedContentModel
|
||||||
{
|
{
|
||||||
/** The classification levels currently configured in this server. */
|
/** The classification levels currently configured in this server. */
|
||||||
private ClassificationLevelManager levelManager;
|
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
|
@Override
|
||||||
public ClassificationLevel getClassificationLevelById(String classificationLevelId) throws LevelIdNotFound
|
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
|
@Override
|
||||||
public ClassificationReason getClassificationReasonById(String classificationReasonId) throws ReasonIdNotFound
|
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
|
* @author tpage
|
||||||
*/
|
*/
|
||||||
public class ClassificationServiceProvider
|
public class ClassificationSchemeServiceProvider
|
||||||
{
|
{
|
||||||
/** Logging utility for the class. */
|
/** 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. */
|
/** 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. */
|
/** Constructor that takes the classification scheme service and makes it available statically. */
|
||||||
public ClassificationServiceProvider(ClassificationService classificationService)
|
public ClassificationSchemeServiceProvider(ClassificationSchemeService classificationSchemeService)
|
||||||
{
|
{
|
||||||
ClassificationService oldClassificationService = CLASSIFICATION_SERVICE_REF.getAndSet(classificationService);
|
ClassificationSchemeService oldClassificationSchemeService = CLASSIFICATION_SCHEME_SERVICE_REF.getAndSet(classificationSchemeService);
|
||||||
if (oldClassificationService != null)
|
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.
|
* @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 java.util.List;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
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.classification.model.ClassifiedContentModel;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil;
|
import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
||||||
|
@@ -24,7 +24,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
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.apache.commons.io.IOUtils;
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
|
@@ -21,7 +21,7 @@ package org.alfresco.module.org_alfresco_module_rm.classification;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
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.
|
* 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 java.util.Set;
|
||||||
|
|
||||||
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationServiceException.InvalidNode;
|
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationException.InvalidNode;
|
||||||
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.ClassificationServiceException.ReasonIdNotFound;
|
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationException.ReasonIdNotFound;
|
||||||
import org.alfresco.service.cmr.repository.InvalidNodeRefException;
|
import org.alfresco.service.cmr.repository.InvalidNodeRefException;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
|
||||||
|
@@ -29,8 +29,8 @@ import java.util.Set;
|
|||||||
|
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.model.QuickShareModel;
|
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.ClassificationException.InvalidNode;
|
||||||
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.classification.model.ClassifiedContentModel;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl;
|
import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl;
|
||||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||||
|
@@ -25,7 +25,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
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.module.org_alfresco_module_rm.util.ServiceBaseImpl;
|
||||||
import org.alfresco.query.PagingRequest;
|
import org.alfresco.query.PagingRequest;
|
||||||
import org.alfresco.query.PagingResults;
|
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}
|
* 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.
|
* which then restricts access to them to users having the appropriate clearance.
|
||||||
* <p/>
|
* <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
|
* for the management of those levels and it is the
|
||||||
* {@link org.alfresco.module.org_alfresco_module_rm.classification.SecurityClearanceService} which deals
|
* {@link org.alfresco.module.org_alfresco_module_rm.classification.SecurityClearanceService} which deals
|
||||||
* wth users and their clearances.
|
* wth users and their clearances.
|
||||||
|
@@ -29,7 +29,7 @@ import java.util.Set;
|
|||||||
|
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.model.ImapModel;
|
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.classification.model.ClassifiedContentModel;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.compatibility.CompatibilityModel;
|
import org.alfresco.module.org_alfresco_module_rm.compatibility.CompatibilityModel;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule;
|
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule;
|
||||||
@@ -85,8 +85,8 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
|
|||||||
/** File Plan Service */
|
/** File Plan Service */
|
||||||
private FilePlanService filePlanService;
|
private FilePlanService filePlanService;
|
||||||
|
|
||||||
/** Classification Service */
|
/** Classification Scheme Service */
|
||||||
private ClassificationService classificationService;
|
private ClassificationSchemeService classificationSchemeService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the disposition service
|
* 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)
|
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);
|
String initialClassificationId = (String) nodeService.getProperty(nodeRef, ClassifiedContentModel.PROP_INITIAL_CLASSIFICATION);
|
||||||
if (isNotBlank(initialClassificationId))
|
if (isNotBlank(initialClassificationId))
|
||||||
{
|
{
|
||||||
String initialClassificationDisplayLabel = getClassificationService().getClassificationLevelById(initialClassificationId).getDisplayLabel();
|
String initialClassificationDisplayLabel = getClassificationSchemeService().getClassificationLevelById(initialClassificationId).getDisplayLabel();
|
||||||
addTransientPropertyField(form, TRANSIENT_INITIAL_CLASSIFICATION, DataTypeDefinition.TEXT, initialClassificationDisplayLabel);
|
addTransientPropertyField(form, TRANSIENT_INITIAL_CLASSIFICATION, DataTypeDefinition.TEXT, initialClassificationDisplayLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
String currentClassificationId = (String) nodeService.getProperty(nodeRef, ClassifiedContentModel.PROP_CURRENT_CLASSIFICATION);
|
String currentClassificationId = (String) nodeService.getProperty(nodeRef, ClassifiedContentModel.PROP_CURRENT_CLASSIFICATION);
|
||||||
if (isNotBlank(currentClassificationId))
|
if (isNotBlank(currentClassificationId))
|
||||||
{
|
{
|
||||||
String currentClassificationDisplayLabel = getClassificationService().getClassificationLevelById(currentClassificationId).getDisplayLabel();
|
String currentClassificationDisplayLabel = getClassificationSchemeService().getClassificationLevelById(currentClassificationId).getDisplayLabel();
|
||||||
addTransientPropertyField(form, TRANSIENT_CURRENT_CLASSIFICATION, DataTypeDefinition.TEXT, currentClassificationDisplayLabel);
|
addTransientPropertyField(form, TRANSIENT_CURRENT_CLASSIFICATION, DataTypeDefinition.TEXT, currentClassificationDisplayLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -227,7 +227,7 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
|
|||||||
for (int i = 0; i < size; i++)
|
for (int i = 0; i < size; i++)
|
||||||
{
|
{
|
||||||
String id = classificationReasons.get(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 ? "|": ""));
|
classificationReasonLabels.add(id + ": " + displayLabel + (i < size - 1 ? "|": ""));
|
||||||
}
|
}
|
||||||
addTransientPropertyField(form, TRANSIENT_CLASSIFICATION_REASON_LABELS, DataTypeDefinition.TEXT, classificationReasonLabels);
|
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.HashMap;
|
||||||
import java.util.Map;
|
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.alfresco.module.org_alfresco_module_rm.script.AbstractRmWebScript;
|
||||||
import org.springframework.extensions.webscripts.Cache;
|
import org.springframework.extensions.webscripts.Cache;
|
||||||
import org.springframework.extensions.webscripts.Status;
|
import org.springframework.extensions.webscripts.Status;
|
||||||
@@ -38,17 +38,17 @@ public class ClassificationLevelsGet extends AbstractRmWebScript
|
|||||||
/** Constants */
|
/** Constants */
|
||||||
private static final String LEVELS = "levels";
|
private static final String LEVELS = "levels";
|
||||||
|
|
||||||
/** Classification service */
|
/** Classification scheme service */
|
||||||
private ClassificationService classificationService;
|
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)
|
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache)
|
||||||
{
|
{
|
||||||
Map<String, Object> result = new HashMap<String, Object>();
|
Map<String, Object> result = new HashMap<String, Object>();
|
||||||
result.put(LEVELS, classificationService.getClassificationLevels());
|
result.put(LEVELS, classificationSchemeService.getClassificationLevels());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -21,7 +21,7 @@ package org.alfresco.module.org_alfresco_module_rm.script.classification;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
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.alfresco.module.org_alfresco_module_rm.script.AbstractRmWebScript;
|
||||||
import org.springframework.extensions.webscripts.Cache;
|
import org.springframework.extensions.webscripts.Cache;
|
||||||
import org.springframework.extensions.webscripts.Status;
|
import org.springframework.extensions.webscripts.Status;
|
||||||
@@ -38,17 +38,17 @@ public class ReasonsGet extends AbstractRmWebScript
|
|||||||
/** Constants */
|
/** Constants */
|
||||||
private static final String REASONS = "reasons";
|
private static final String REASONS = "reasons";
|
||||||
|
|
||||||
/** Classification service */
|
/** Classification scheme service */
|
||||||
private ClassificationService classificationService;
|
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)
|
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache)
|
||||||
{
|
{
|
||||||
Map<String, Object> result = new HashMap<String, Object>();
|
Map<String, Object> result = new HashMap<String, Object>();
|
||||||
result.put(REASONS, classificationService.getClassificationReasons());
|
result.put(REASONS, classificationSchemeService.getClassificationReasons());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.module.org_alfresco_module_rm.script.classification;
|
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.SecurityClearance;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.classification.SecurityClearanceService;
|
import org.alfresco.module.org_alfresco_module_rm.classification.SecurityClearanceService;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.script.AbstractRmWebScript;
|
import org.alfresco.module.org_alfresco_module_rm.script.AbstractRmWebScript;
|
||||||
@@ -72,7 +72,7 @@ public class UserSecurityClearancePut extends AbstractRmWebScript
|
|||||||
securityClearance = securityClearanceService.setUserSecurityClearance(username,
|
securityClearance = securityClearanceService.setUserSecurityClearance(username,
|
||||||
clearanceId);
|
clearanceId);
|
||||||
}
|
}
|
||||||
catch (ClassificationServiceException.LevelIdNotFound exception)
|
catch (ClassificationException.LevelIdNotFound exception)
|
||||||
{
|
{
|
||||||
throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Unable to find clearance level");
|
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
|
public void then() throws Exception
|
||||||
{
|
{
|
||||||
List<ClassificationLevel> levels = classificationService.getClassificationLevels();
|
List<ClassificationLevel> levels = classificationSchemeService.getClassificationLevels();
|
||||||
assertNotNull(levels);
|
assertNotNull(levels);
|
||||||
assertEquals("Expected 5 levels to be configured (4 defined in the test plus Unclassified)", 5, levels.size());
|
assertEquals("Expected 5 levels to be configured (4 defined in the test plus Unclassified)", 5, levels.size());
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@ public class ClassificationLevelsTest extends BaseRMTestCase
|
|||||||
assertEquals(level2.getId(), LEVEL2_ID);
|
assertEquals(level2.getId(), LEVEL2_ID);
|
||||||
assertEquals(level3.getId(), LEVEL3_ID);
|
assertEquals(level3.getId(), LEVEL3_ID);
|
||||||
assertEquals(level4.getId(), LEVEL4_ID);
|
assertEquals(level4.getId(), LEVEL4_ID);
|
||||||
|
|
||||||
assertEquals(ClassificationLevelManager.UNCLASSIFIED, levels.get(4));
|
assertEquals(ClassificationLevelManager.UNCLASSIFIED, levels.get(4));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@@ -22,25 +22,24 @@ package org.alfresco.module.org_alfresco_module_rm.test.integration.classificati
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationReason;
|
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;
|
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests of classification reason handling.
|
* Tests of classification reason handling.
|
||||||
*
|
*
|
||||||
* @author tpage
|
* @author tpage
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public class ClassificationReasonsTest extends BaseRMTestCase
|
public class ClassificationReasonsTest extends BaseRMTestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Given the default classification reasons config file is on the classpath
|
* Given the default classification reasons config file is on the classpath When the system has finished starting up
|
||||||
* When the system has finished starting up
|
|
||||||
* Then the classification service exposes the classification reasons.
|
* Then the classification service exposes the classification reasons.
|
||||||
* <p>
|
* <p>
|
||||||
* Note that this test requires a clean db, as otherwise the classification service will use the persisted
|
* 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
|
* classification reasons in preference to those given on the classpath (see the logic in
|
||||||
* ClassificationServiceImpl#initConfiguredClassificationReasons()}).
|
* {@link ClassificationSchemeServiceImpl#initConfiguredClassificationReasons()}).
|
||||||
*/
|
*/
|
||||||
public void testLoadBootstrappedClassificationReasons() throws Exception
|
public void testLoadBootstrappedClassificationReasons() throws Exception
|
||||||
{
|
{
|
||||||
@@ -58,8 +57,8 @@ public class ClassificationReasonsTest extends BaseRMTestCase
|
|||||||
|
|
||||||
public void then() throws Exception
|
public void then() throws Exception
|
||||||
{
|
{
|
||||||
// Check the classification service exposes the classification reasons.
|
// Check the classification scheme service exposes the classification reasons.
|
||||||
List<ClassificationReason> reasons = classificationService.getClassificationReasons();
|
List<ClassificationReason> reasons = classificationSchemeService.getClassificationReasons();
|
||||||
assertNotNull(reasons);
|
assertNotNull(reasons);
|
||||||
assertEquals("The default classification reasons in test/resources/alfresco/module/"
|
assertEquals("The default classification reasons in test/resources/alfresco/module/"
|
||||||
+ "org_alfresco_module_rm/classification/rm-classification-reasons.json "
|
+ "org_alfresco_module_rm/classification/rm-classification-reasons.json "
|
||||||
|
@@ -22,7 +22,7 @@ import java.util.Collections;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.google.common.collect.Sets;
|
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.classification.model.ClassifiedContentModel;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService;
|
import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
|
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;
|
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.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.ClearanceLevel;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.classification.SecurityClearance;
|
import org.alfresco.module.org_alfresco_module_rm.classification.SecurityClearance;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
|
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
|
||||||
|
@@ -29,8 +29,8 @@ 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.audit.RecordsManagementAuditService;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService;
|
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.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.ContentClassificationService;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.classification.SecurityClearanceService;
|
import org.alfresco.module.org_alfresco_module_rm.classification.SecurityClearanceService;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.dataset.DataSetService;
|
import org.alfresco.module.org_alfresco_module_rm.dataset.DataSetService;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule;
|
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule;
|
||||||
@@ -163,7 +163,7 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
|
|||||||
protected HoldService holdService;
|
protected HoldService holdService;
|
||||||
protected InplaceRecordService inplaceRecordService;
|
protected InplaceRecordService inplaceRecordService;
|
||||||
protected RelationshipService relationshipService;
|
protected RelationshipService relationshipService;
|
||||||
protected ClassificationService classificationService;
|
protected ClassificationSchemeService classificationSchemeService;
|
||||||
protected SecurityClearanceService securityClearanceService;
|
protected SecurityClearanceService securityClearanceService;
|
||||||
protected ContentClassificationService contentClassificationService;
|
protected ContentClassificationService contentClassificationService;
|
||||||
|
|
||||||
@@ -405,7 +405,7 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
|
|||||||
holdService = (HoldService) applicationContext.getBean("HoldService");
|
holdService = (HoldService) applicationContext.getBean("HoldService");
|
||||||
inplaceRecordService = (InplaceRecordService) applicationContext.getBean("InplaceRecordService");
|
inplaceRecordService = (InplaceRecordService) applicationContext.getBean("InplaceRecordService");
|
||||||
relationshipService = (RelationshipService) applicationContext.getBean("RelationshipService");
|
relationshipService = (RelationshipService) applicationContext.getBean("RelationshipService");
|
||||||
classificationService = (ClassificationService) applicationContext.getBean("ClassificationService");
|
classificationSchemeService = (ClassificationSchemeService) applicationContext.getBean("ClassificationSchemeService");
|
||||||
securityClearanceService = (SecurityClearanceService) applicationContext.getBean("SecurityClearanceService");
|
securityClearanceService = (SecurityClearanceService) applicationContext.getBean("SecurityClearanceService");
|
||||||
contentClassificationService = (ContentClassificationService) applicationContext.getBean("ContentClassificationService");
|
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);
|
private static final List<ClassificationLevel> DEFAULT_LEVELS = Arrays.asList(LEVEL_ONE, LEVEL_TWO);
|
||||||
|
|
||||||
@InjectMocks ClassificationLevelConstraint classificationLevelConstraint;
|
@InjectMocks ClassificationLevelConstraint classificationLevelConstraint;
|
||||||
@Mock ClassificationService mockClassificationService;
|
@Mock ClassificationSchemeService mockClassificationSchemeService;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp()
|
public void setUp()
|
||||||
@@ -50,7 +50,7 @@ public class ClassificationLevelConstraintUnitTest
|
|||||||
MockitoAnnotations.initMocks(this);
|
MockitoAnnotations.initMocks(this);
|
||||||
|
|
||||||
// Currently this list of levels suffices for all the tests.
|
// 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. */
|
/** 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.Arrays;
|
||||||
import java.util.List;
|
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.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
@@ -63,14 +63,14 @@ public class ClassificationLevelManagerUnitTest
|
|||||||
ClassificationLevel actual = classificationLevelManager.getMostSecureLevel();
|
ClassificationLevel actual = classificationLevelManager.getMostSecureLevel();
|
||||||
assertEquals(LEVEL_1, actual);
|
assertEquals(LEVEL_1, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given that I have created the classification level manager with a list of classification levels
|
* Given that I have created the classification level manager with a list of classification levels
|
||||||
* Then the unclassified level is available
|
* Then the unclassified level is available
|
||||||
*/
|
*/
|
||||||
@Test public void getUnclassifiedLevel()
|
@Test public void getUnclassifiedLevel()
|
||||||
{
|
{
|
||||||
assertEquals(LEVELS.size() + 1, classificationLevelManager.getClassificationLevels().size());
|
assertEquals(LEVELS.size() + 1, classificationLevelManager.getClassificationLevels().size());
|
||||||
assertEquals(ClassificationLevelManager.UNCLASSIFIED, classificationLevelManager.findLevelById(ClassificationLevelManager.UNCLASSIFIED_ID));
|
assertEquals(ClassificationLevelManager.UNCLASSIFIED, classificationLevelManager.findLevelById(ClassificationLevelManager.UNCLASSIFIED_ID));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -23,7 +23,7 @@ import static org.junit.Assert.assertEquals;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
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.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@@ -27,8 +27,8 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
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.ClassificationServiceException.ReasonIdNotFound;
|
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.module.org_alfresco_module_rm.test.util.ExceptionUtils;
|
||||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
@@ -42,12 +42,12 @@ import org.mockito.Mock;
|
|||||||
import org.mockito.MockitoAnnotations;
|
import org.mockito.MockitoAnnotations;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unit tests for {@link ClassificationServiceImpl}.
|
* Unit tests for {@link ClassificationSchemeServiceImpl}.
|
||||||
*
|
*
|
||||||
* @author Neil Mc Erlean
|
* @author Neil Mc Erlean
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public class ClassificationServiceImplUnitTest
|
public class ClassificationSchemeServiceImplUnitTest
|
||||||
{
|
{
|
||||||
private static final List<ClassificationLevel> DEFAULT_CLASSIFICATION_LEVELS = asLevelList("Top Secret", "rm.classification.topSecret",
|
private static final List<ClassificationLevel> DEFAULT_CLASSIFICATION_LEVELS = asLevelList("Top Secret", "rm.classification.topSecret",
|
||||||
"Secret", "rm.classification.secret",
|
"Secret", "rm.classification.secret",
|
||||||
@@ -78,7 +78,7 @@ public class ClassificationServiceImplUnitTest
|
|||||||
return levels;
|
return levels;
|
||||||
}
|
}
|
||||||
|
|
||||||
@InjectMocks private ClassificationServiceImpl classificationServiceImpl;
|
@InjectMocks private ClassificationSchemeServiceImpl classificationSchemeServiceImpl;
|
||||||
|
|
||||||
@Mock private NodeService mockNodeService;
|
@Mock private NodeService mockNodeService;
|
||||||
@Mock private DictionaryService mockDictionaryService;
|
@Mock private DictionaryService mockDictionaryService;
|
||||||
@@ -99,7 +99,7 @@ public class ClassificationServiceImplUnitTest
|
|||||||
{
|
{
|
||||||
ClassificationLevel targetLevel = new ClassificationLevel("Secret", "rm.classification.secret");
|
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",
|
List<ClassificationLevel> expected = asLevelList("Secret", "rm.classification.secret",
|
||||||
"Confidential", "rm.classification.confidential",
|
"Confidential", "rm.classification.confidential",
|
||||||
@@ -116,7 +116,7 @@ public class ClassificationServiceImplUnitTest
|
|||||||
{
|
{
|
||||||
ClassificationLevel targetLevel = new ClassificationLevel("UnrecognisedLevel", "rm.classification.IMadeThisUp");
|
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());
|
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";
|
String levelId = "classificationLevelId1";
|
||||||
ClassificationLevel classificationLevel = new ClassificationLevel(levelId, "displayLabelKey");
|
ClassificationLevel classificationLevel = new ClassificationLevel(levelId, "displayLabelKey");
|
||||||
when(mockLevelManager.findLevelById(levelId)).thenReturn(classificationLevel);
|
when(mockLevelManager.findLevelById(levelId)).thenReturn(classificationLevel);
|
||||||
ClassificationLevel classificationLevelById = classificationServiceImpl.getClassificationLevelById(levelId);
|
ClassificationLevel classificationLevelById = classificationSchemeServiceImpl.getClassificationLevelById(levelId);
|
||||||
assertEquals(classificationLevel, classificationLevelById);
|
assertEquals(classificationLevel, classificationLevelById);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,7 +136,7 @@ public class ClassificationServiceImplUnitTest
|
|||||||
{
|
{
|
||||||
String classificationLevelId = "aRandomId";
|
String classificationLevelId = "aRandomId";
|
||||||
doThrow(new LevelIdNotFound("Id not found!")).when(mockLevelManager).findLevelById(classificationLevelId);
|
doThrow(new LevelIdNotFound("Id not found!")).when(mockLevelManager).findLevelById(classificationLevelId);
|
||||||
classificationServiceImpl.getClassificationLevelById(classificationLevelId);
|
classificationSchemeServiceImpl.getClassificationLevelById(classificationLevelId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -145,7 +145,7 @@ public class ClassificationServiceImplUnitTest
|
|||||||
String reasonId = "classificationReasonId1";
|
String reasonId = "classificationReasonId1";
|
||||||
ClassificationReason classificationReason = new ClassificationReason(reasonId, "displayLabelKey");
|
ClassificationReason classificationReason = new ClassificationReason(reasonId, "displayLabelKey");
|
||||||
when(mockReasonManager.findReasonById(reasonId)).thenReturn(classificationReason);
|
when(mockReasonManager.findReasonById(reasonId)).thenReturn(classificationReason);
|
||||||
ClassificationReason classificationReasonById = classificationServiceImpl.getClassificationReasonById(reasonId);
|
ClassificationReason classificationReasonById = classificationSchemeServiceImpl.getClassificationReasonById(reasonId);
|
||||||
assertEquals(classificationReason, classificationReasonById);
|
assertEquals(classificationReason, classificationReasonById);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,6 +154,6 @@ public class ClassificationServiceImplUnitTest
|
|||||||
{
|
{
|
||||||
String classificationReasonId = "aRandomId";
|
String classificationReasonId = "aRandomId";
|
||||||
doThrow(new ReasonIdNotFound("Id not found!")).when(mockReasonManager).findReasonById(classificationReasonId);
|
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 java.util.stream.Stream;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
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.test.util.MockAuthenticationUtilHelper;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil;
|
import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil;
|
||||||
import org.alfresco.service.cmr.attributes.AttributeService;
|
import org.alfresco.service.cmr.attributes.AttributeService;
|
||||||
|
@@ -18,14 +18,14 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.module.org_alfresco_module_rm.classification;
|
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.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
import java.util.List;
|
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;
|
import org.junit.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -23,7 +23,7 @@ import static org.junit.Assert.assertEquals;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
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.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@@ -42,8 +42,8 @@ import com.google.common.collect.Sets;
|
|||||||
|
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.model.QuickShareModel;
|
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.ClassificationException.InvalidNode;
|
||||||
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.classification.model.ClassifiedContentModel;
|
||||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
@@ -31,7 +31,7 @@ import static org.mockito.Mockito.when;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
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.test.util.MockAuthenticationUtilHelper;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil;
|
import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil;
|
||||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||||
@@ -62,7 +62,7 @@ public class SecurityClearanceServiceImplUnitTest
|
|||||||
@Mock private DictionaryService mockDictionaryService;
|
@Mock private DictionaryService mockDictionaryService;
|
||||||
@Mock private NodeService mockNodeService;
|
@Mock private NodeService mockNodeService;
|
||||||
@Mock private PersonService mockPersonService;
|
@Mock private PersonService mockPersonService;
|
||||||
@Mock private ClassificationService mockClassificationService;
|
@Mock private ClassificationSchemeService mockClassificationSchemeService;
|
||||||
@Mock private ClearanceLevelManager mockClearanceLevelManager;
|
@Mock private ClearanceLevelManager mockClearanceLevelManager;
|
||||||
@Mock private ClassificationLevelComparator mockClassificationLevelComparator;
|
@Mock private ClassificationLevelComparator mockClassificationLevelComparator;
|
||||||
|
|
||||||
@@ -95,7 +95,7 @@ public class SecurityClearanceServiceImplUnitTest
|
|||||||
{
|
{
|
||||||
final PersonInfo user1 = createMockPerson("user1", "User", "One", null);
|
final PersonInfo user1 = createMockPerson("user1", "User", "One", null);
|
||||||
MockAuthenticationUtilHelper.setup(mockAuthenticationUtil, user1.getUserName());
|
MockAuthenticationUtilHelper.setup(mockAuthenticationUtil, user1.getUserName());
|
||||||
when(mockClassificationService.getUnclassifiedClassificationLevel())
|
when(mockClassificationSchemeService.getUnclassifiedClassificationLevel())
|
||||||
.thenReturn(ClassificationLevelManager.UNCLASSIFIED);
|
.thenReturn(ClassificationLevelManager.UNCLASSIFIED);
|
||||||
when(mockClearanceLevelManager.findLevelByClassificationLevelId(ClassificationLevelManager.UNCLASSIFIED_ID))
|
when(mockClearanceLevelManager.findLevelByClassificationLevelId(ClassificationLevelManager.UNCLASSIFIED_ID))
|
||||||
.thenReturn(ClearanceLevelManager.NO_CLEARANCE);
|
.thenReturn(ClearanceLevelManager.NO_CLEARANCE);
|
||||||
|
@@ -28,7 +28,7 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationLevel;
|
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.alfresco.module.org_alfresco_module_rm.test.util.BaseWebScriptUnitTest;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@@ -53,7 +53,7 @@ public class ClassificationLevelsGetUnitTest extends BaseWebScriptUnitTest
|
|||||||
|
|
||||||
/** ClassificationLevelsGet webscript instance */
|
/** ClassificationLevelsGet webscript instance */
|
||||||
private @Spy @InjectMocks ClassificationLevelsGet webScript;
|
private @Spy @InjectMocks ClassificationLevelsGet webScript;
|
||||||
private @Mock ClassificationService mockClassificationService;
|
private @Mock ClassificationSchemeService mockClassificationSchemeService;
|
||||||
|
|
||||||
private List<ClassificationLevel> classificationLevels;
|
private List<ClassificationLevel> classificationLevels;
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ public class ClassificationLevelsGetUnitTest extends BaseWebScriptUnitTest
|
|||||||
new ClassificationLevel("id2", "labelKey2"));
|
new ClassificationLevel("id2", "labelKey2"));
|
||||||
|
|
||||||
// setup interactions
|
// setup interactions
|
||||||
doReturn(classificationLevels).when(mockClassificationService).getClassificationLevels();
|
doReturn(classificationLevels).when(mockClassificationSchemeService).getClassificationLevels();
|
||||||
|
|
||||||
// execute web script
|
// execute web script
|
||||||
JSONObject json = executeJSONWebScript(new HashMap<String, String>());
|
JSONObject json = executeJSONWebScript(new HashMap<String, String>());
|
||||||
|
@@ -29,7 +29,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationReason;
|
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.alfresco.module.org_alfresco_module_rm.test.util.BaseWebScriptUnitTest;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@@ -53,7 +53,7 @@ public class ReasonsGetUnitTest extends BaseWebScriptUnitTest
|
|||||||
|
|
||||||
/** ReasonsGet webscript instance */
|
/** ReasonsGet webscript instance */
|
||||||
private @Spy @InjectMocks ReasonsGet webScript;
|
private @Spy @InjectMocks ReasonsGet webScript;
|
||||||
private @Mock ClassificationService mockClassificationService;
|
private @Mock ClassificationSchemeService mockClassificationSchemeService;
|
||||||
|
|
||||||
private List<ClassificationReason> reasonsList;
|
private List<ClassificationReason> reasonsList;
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ public class ReasonsGetUnitTest extends BaseWebScriptUnitTest
|
|||||||
reasonsList = Arrays.asList(reasonA, reasonB);
|
reasonsList = Arrays.asList(reasonA, reasonB);
|
||||||
|
|
||||||
// setup interactions
|
// setup interactions
|
||||||
doReturn(reasonsList).when(mockClassificationService).getClassificationReasons();
|
doReturn(reasonsList).when(mockClassificationSchemeService).getClassificationReasons();
|
||||||
|
|
||||||
// setup web script parameters
|
// setup web script parameters
|
||||||
Map<String, String> parameters = new HashMap<String, String>();
|
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.JsonNode;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
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.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.ClearanceLevel;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.classification.SecurityClearance;
|
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.classification.SecurityClearanceService;
|
||||||
@@ -114,7 +114,7 @@ public class UserSecurityClearancePutUnitTest extends BaseWebScriptUnitTest
|
|||||||
Map<String, String> parameters = buildParameters(USERNAME, username, CLEARANCE_ID, clearanceId);
|
Map<String, String> parameters = buildParameters(USERNAME, username, CLEARANCE_ID, clearanceId);
|
||||||
|
|
||||||
when(mockSecurityClearanceService.setUserSecurityClearance(username, 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.
|
// Execute web script - this should throw the expected exception.
|
||||||
executeJSONWebScript(parameters);
|
executeJSONWebScript(parameters);
|
||||||
@@ -135,7 +135,7 @@ public class UserSecurityClearancePutUnitTest extends BaseWebScriptUnitTest
|
|||||||
Map<String, String> parameters = buildParameters(USERNAME, username, CLEARANCE_ID, clearanceId);
|
Map<String, String> parameters = buildParameters(USERNAME, username, CLEARANCE_ID, clearanceId);
|
||||||
|
|
||||||
when(mockSecurityClearanceService.setUserSecurityClearance(username, clearanceId)).thenThrow(
|
when(mockSecurityClearanceService.setUserSecurityClearance(username, clearanceId)).thenThrow(
|
||||||
new ClassificationServiceException.LevelIdNotFound(clearanceId));
|
new ClassificationException.LevelIdNotFound(clearanceId));
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user