RM-2333, RM-2341, RM-2342, RM-2343, RM-2344, RM-2346.

Changed Classification Agency to optional throughtout the stack and added a new mandatory property Classified By throughout the stack.
Addressing the fallout in the existing tests due to these changes.
Also enhanced some existing tests to validate the classified by value persistence.

Still to do: need to initialise the Classified By field in the Classify dialog to the current user's full name (not as easy as I'd thought) and add additional AC tests.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@107433 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Neil McErlean
2015-06-30 15:32:47 +00:00
parent 1303566099
commit fa3f1230a4
18 changed files with 77 additions and 48 deletions

View File

@@ -45,6 +45,7 @@ public interface ContentClassificationService
* Classify a piece of content.
*
* @param classificationLevelId The security clearance needed to access the content.
* @param classifiedBy Free-form text identifying who classified the content.
* @param classificationAgency The name of the agency responsible for the classification of this content.
* @param classificationReasonIds A non-empty set of ids of reasons for classifying the content in this way.
* @param content The node to classify.
@@ -53,7 +54,8 @@ public interface ContentClassificationService
* @throws InvalidNodeRefException If the node could not be found.
* @throws InvalidNode If the supplied node is not a content node.
*/
void classifyContent(String classificationLevelId, String classificationAgency, Set<String> classificationReasonIds, NodeRef content)
void classifyContent(String classificationLevelId, String classifiedBy, String classificationAgency,
Set<String> classificationReasonIds, NodeRef content)
throws LevelIdNotFound, ReasonIdNotFound, InvalidNodeRefException, InvalidNode;
/**

View File

@@ -85,11 +85,11 @@ public class ContentClassificationServiceImpl extends ServiceBaseImpl implements
};
@Override
public void classifyContent(String classificationLevelId, String classificationAgency,
Set<String> classificationReasonIds, final NodeRef content)
public void classifyContent(String classificationLevelId, String classifiedBy, String classificationAgency,
Set<String> classificationReasonIds, final NodeRef content)
{
checkNotBlank("classificationLevelId", classificationLevelId);
checkNotBlank("classificationAgency", classificationAgency);
mandatory("classifiedBy", classifiedBy);
mandatory("classificationReasonIds", classificationReasonIds);
mandatory("content", content);
@@ -111,7 +111,7 @@ public class ContentClassificationServiceImpl extends ServiceBaseImpl implements
throw new LevelIdNotFound(classificationLevelId);
}
final Map<QName, Serializable> properties = new HashMap<QName, Serializable>();
final Map<QName, Serializable> properties = new HashMap<>();
// Initial classification id
if (nodeService.getProperty(content, PROP_INITIAL_CLASSIFICATION) == null)
{
@@ -124,6 +124,8 @@ public class ContentClassificationServiceImpl extends ServiceBaseImpl implements
// Classification agency
properties.put(PROP_CLASSIFICATION_AGENCY, classificationAgency);
properties.put(PROP_CLASSIFIED_BY, classifiedBy);
// Classification reason ids
HashSet<String> classificationReasons = new HashSet<>();
for (String classificationReasonId : classificationReasonIds)

View File

@@ -45,6 +45,7 @@ public interface ClassifiedContentModel
QName PROP_INITIAL_CLASSIFICATION = QName.createQName(CLF_URI, "initialClassification");
QName PROP_CURRENT_CLASSIFICATION = QName.createQName(CLF_URI, "currentClassification");
QName PROP_CLASSIFICATION_AGENCY = QName.createQName(CLF_URI, "classificationAgency");
QName PROP_CLASSIFIED_BY = QName.createQName(CLF_URI, "classifiedBy");
QName PROP_CLASSIFICATION_REASONS = QName.createQName(CLF_URI, "classificationReasons");
/** Security Clearance aspect. */

View File

@@ -47,6 +47,7 @@ public class ClassifyContentPost extends AbstractRmWebScript
{
/** Constants */
public static final String CLASSIFICATION_LEVEL_ID = "classificationLevelId";
public static final String CLASSIFIED_BY = "classifiedBy";
public static final String CLASSIFICATION_AGENCY = "classificationAgency";
public static final String CLASSIFICATION_REASONS = "classificationReasons";
@@ -73,11 +74,13 @@ public class ClassifyContentPost extends AbstractRmWebScript
{
JSONObject jsonObject = getRequestContentAsJsonObject(req);
String classificationLevelId = getStringValueFromJSONObject(jsonObject, CLASSIFICATION_LEVEL_ID);
String classificationAgency = getStringValueFromJSONObject(jsonObject, CLASSIFICATION_AGENCY);
String classifiedBy = getStringValueFromJSONObject(jsonObject, CLASSIFIED_BY);
String classificationAgency = getStringValueFromJSONObject(jsonObject, CLASSIFICATION_AGENCY, false, false);
Set<String> classificationReasonIds = getClassificationReasonIds(jsonObject);
NodeRef document = parseRequestForNodeRef(req);
contentClassificationService.classifyContent(classificationLevelId, classificationAgency, classificationReasonIds, document);
contentClassificationService.classifyContent(classificationLevelId, classifiedBy, classificationAgency,
classificationReasonIds, document);
Map<String, Object> model = new HashMap<>(1);
model.put(SUCCESS, true);