RM-2061 (Add classification properties to document details view)

RM-2062 (Add classification properties to record details view)

+review RM-29

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@102759 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tuna Aksoy
2015-04-27 13:45:05 +00:00
parent 899cf5fad1
commit 3e2fd99f96
6 changed files with 126 additions and 23 deletions

View File

@@ -53,7 +53,7 @@ public interface ClassificationService
/**
* Classify a piece of content.
*
*
* @param classificationLevelId The security clearance needed to access the content.
* @param classificationAuthority The name of the authority responsible for the classification of this content.
* @param classificationReasonIds A non-empty set of ids of reasons for classifying the content in this way.
@@ -66,4 +66,22 @@ public interface ClassificationService
void classifyContent(String classificationLevelId, String classificationAuthority,
Set<String> classificationReasonIds, NodeRef content) throws LevelIdNotFound, ReasonIdNotFound,
InvalidNodeRefException, InvalidNode;
/**
* Gets the classification level for the given classification level id
*
* @param classificationLevelId {@link String} The classification level id for which the classification level should be retrieved.
* @return The classification level for the given classification level id
* @throws LevelIdNotFound If the given classification level id is not found
*/
ClassificationLevel getClassificationLevelById(String classificationLevelId) throws LevelIdNotFound;
/**
* Gets the classification reason for the given classification reason id
*
* @param classificationReasonId {@link String} The classification reason id for which the classification reason should be retrieved.
* @return The classification reason for the given classification reason id
* @throws ReasonIdNotFound If the given classification reason id is not found
*/
ClassificationReason getClassificationReasonById(String classificationReasonId) throws ReasonIdNotFound;
}

View File

@@ -238,7 +238,8 @@ public class ClassificationServiceImpl extends ServiceBaseImpl
}
Map<QName, Serializable> properties = new HashMap<QName, Serializable>();
checkClassificationLevelId(classificationLevelId);
// Check the classification level id - an exception will be thrown if the id cannot be found
getClassificationLevelById(classificationLevelId);
// Initial classification id
if (nodeService.getProperty(content, PROP_INITIAL_CLASSIFICATION) == null)
@@ -256,7 +257,8 @@ public class ClassificationServiceImpl extends ServiceBaseImpl
HashSet<String> classificationReasons = new HashSet<>();
for (String classificationReasonId : classificationReasonIds)
{
checkClassificationReasonId(classificationReasonId);
// Check the classification reason id - an exception will be thrown if the id cannot be found
getClassificationReasonById(classificationReasonId);
classificationReasons.add(classificationReasonId);
}
properties.put(PROP_CLASSIFICATION_REASONS, classificationReasons);
@@ -266,24 +268,22 @@ public class ClassificationServiceImpl extends ServiceBaseImpl
}
/**
* Helper method to check if a classification level with the given id exists
*
* @param classificationLevelId {@link String} The id of the classification level
* @throws {@link LevelIdNotFound} throws an exception if a classification level with given id does not exist
* @see org.alfresco.module.org_alfresco_module_rm.classification.ClassificationService#getClassificationLevelById(java.lang.String)
*/
private void checkClassificationLevelId(String classificationLevelId) throws LevelIdNotFound
@Override
public ClassificationLevel getClassificationLevelById(String classificationLevelId) throws LevelIdNotFound
{
levelManager.findLevelById(classificationLevelId);
checkNotBlank("classificationLevelId", classificationLevelId);
return levelManager.findLevelById(classificationLevelId);
}
/**
* Helper method to check if a classification reason with the given id exists
*
* @param classificationReasonId {@String} The id of the classification reason
* @throws {@link ReasonIdNotFound} throws an exception if a classification reason with the given id does not exist
* @see org.alfresco.module.org_alfresco_module_rm.classification.ClassificationService#getClassificationReasonById(java.lang.String)
*/
private void checkClassificationReasonId(String classificationReasonId) throws ReasonIdNotFound
@Override
public ClassificationReason getClassificationReasonById(String classificationReasonId) throws ReasonIdNotFound
{
reasonManager.findReasonById(classificationReasonId);
checkNotBlank("classificationReasonId", classificationReasonId);
return reasonManager.findReasonById(classificationReasonId);
}
}

View File

@@ -19,13 +19,17 @@
package org.alfresco.module.org_alfresco_module_rm.forms;
import static org.alfresco.repo.security.authentication.AuthenticationUtil.runAsSystem;
import static org.apache.commons.lang.StringUtils.isNotBlank;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
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.model.ClassifiedContentModel;
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.DispositionScheduleImpl;
@@ -70,6 +74,8 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
protected static final String TRANSIENT_DECLARED = "rmDeclared";
protected static final String TRANSIENT_CATEGORY_ID = "rmCategoryIdentifier";
protected static final String TRANSIENT_DISPOSITION_INSTRUCTIONS = "rmDispositionInstructions";
protected static final String TRANSIENT_CURRENT_CLASSIFICATION = "clfCurrentClassification";
protected static final String TRANSIENT_INITIAL_CLASSIFICATION = "clfInitialClassification";
/** Disposition service */
private DispositionService dispositionService;
@@ -77,6 +83,9 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
/** File Plan Service */
private FilePlanService filePlanService;
/** Classification Service */
private ClassificationService classificationService;
/**
* Returns the disposition service
*
@@ -97,6 +106,16 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
return this.filePlanService;
}
/**
* Returns the classification service
*
* @return Classification service
*/
protected ClassificationService getClassificationService()
{
return this.classificationService;
}
/**
* Sets the disposition service
*
@@ -115,6 +134,14 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
this.filePlanService = filePlanService;
}
/**
* @param classificationService classification service
*/
public void setClassificationService(ClassificationService classificationService)
{
this.classificationService = classificationService;
}
/**
* @see org.alfresco.repo.forms.processor.Filter#afterGenerate(java.lang.Object, java.util.List, java.util.List, org.alfresco.repo.forms.Form, java.util.Map)
*/
@@ -171,7 +198,23 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
protectRecordLevelDispositionPropertyField(form);
}
}
}
if (dictionaryService.isSubClass(nodeService.getType(nodeRef), ContentModel.TYPE_CONTENT))
{
String initialClassificationId = (String) nodeService.getProperty(nodeRef, ClassifiedContentModel.PROP_INITIAL_CLASSIFICATION);
if (isNotBlank(initialClassificationId))
{
String initialClassificationDisplayLabel = getClassificationService().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();
addTransientPropertyField(form, TRANSIENT_CURRENT_CLASSIFICATION, DataTypeDefinition.TEXT, currentClassificationDisplayLabel);
}
}
}