RM-2433 (Extend REST API for content reclassification)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@109307 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tuna Aksoy
2015-07-31 15:30:43 +00:00
parent 50bbb2b4ff
commit 355f17d2b3
3 changed files with 94 additions and 6 deletions

View File

@@ -34,60 +34,82 @@ public class ClassificationAspectProperties
{
/** The security clearance needed to access the content. */
private String classificationLevelId;
/** Free-form text identifying who classified the content. */
private String classifiedBy;
/** The name of the agency responsible for the classification of this content. */
private String classificationAgency;
/** A non-empty set of ids of reasons for classifying the content in this way. */
private Set<String> classificationReasonIds = new HashSet<>();
/** If provided, this is the date of the next downgrade evaluation. */
private Date downgradeDate;
/** If provided, this is the event at which the next downgrade evaluation will take place. */
private String downgradeEvent;
/** If a downgrade date or event is given then this must be provided too with the instructions for the evaluation. */
private String downgradeInstructions;
/** If provided, this is the date of the next declassification evaluation. */
private Date declassificationDate;
/** If provided, this is the event at which the next declassification evaluation will take place. */
private String declassificationEvent;
/** An optional list of exemption category ids. */
private Set<String> exemptionCategoryIds = new HashSet<>();
/** This needs to be provided if the classification level is changed */
private String lastReclassifyBy;
/** This needs to be provided if the classification level is changed */
private String lastReclassifyReason;
/** @return The security clearance needed to access the content. */
public String getClassificationLevelId()
{
return classificationLevelId;
}
/** @param classificationLevelId The security clearance needed to access the content. */
public void setClassificationLevelId(String classificationLevelId)
{
this.classificationLevelId = classificationLevelId;
}
/** @return Free-form text identifying who classified the content. */
public String getClassifiedBy()
{
return classifiedBy;
}
/** @param classifiedBy Free-form text identifying who classified the content. */
public void setClassifiedBy(String classifiedBy)
{
this.classifiedBy = classifiedBy;
}
/** @return The name of the agency responsible for the classification of this content. */
public String getClassificationAgency()
{
return classificationAgency;
}
/** @param classificationAgency The name of the agency responsible for the classification of this content. */
public void setClassificationAgency(String classificationAgency)
{
this.classificationAgency = classificationAgency;
}
/** @return A non-empty set of ids of reasons for classifying the content in this way. */
public Set<String> getClassificationReasonIds()
{
return classificationReasonIds;
}
/**
* Store an immutable copy of the given set of classification reason ids.
*
@@ -97,61 +119,73 @@ public class ClassificationAspectProperties
{
this.classificationReasonIds = ImmutableSet.copyOf(classificationReasonIds);
}
/** @return If provided, this is the date of the next downgrade evaluation. */
public Date getDowngradeDate()
{
return downgradeDate;
}
/** @param downgradeDate If provided, this is the date of the next downgrade evaluation. */
public void setDowngradeDate(Date downgradeDate)
{
this.downgradeDate = downgradeDate;
}
/** @return If provided, this is the event at which the next downgrade evaluation will take place. */
public String getDowngradeEvent()
{
return downgradeEvent;
}
/** @param downgradeEvent If provided, this is the event at which the next downgrade evaluation will take place. */
public void setDowngradeEvent(String downgradeEvent)
{
this.downgradeEvent = downgradeEvent;
}
/** @return If a downgrade date or event is given then this must be provided too with the instructions for the evaluation. */
public String getDowngradeInstructions()
{
return downgradeInstructions;
}
/** @param downgradeInstructions If a downgrade date or event is given then this must be provided too with the instructions for the evaluation. */
public void setDowngradeInstructions(String downgradeInstructions)
{
this.downgradeInstructions = downgradeInstructions;
}
/** @return If provided, this is the date of the next declassification evaluation. */
public Date getDeclassificationDate()
{
return declassificationDate;
}
/** @param declassificationDate If provided, this is the date of the next declassification evaluation. */
public void setDeclassificationDate(Date declassificationDate)
{
this.declassificationDate = declassificationDate;
}
/** @return If provided, this is the event at which the next declassification evaluation will take place. */
public String getDeclassificationEvent()
{
return declassificationEvent;
}
/** @param declassificationEvent If provided, this is the event at which the next declassification evaluation will take place. */
public void setDeclassificationEvent(String declassificationEvent)
{
this.declassificationEvent = declassificationEvent;
}
/** @return This is an optional list of exemption category ids. */
public Set<String> getExemptionCategoryIds()
{
return exemptionCategoryIds;
}
/**
* Store an immutable copy of the given set of exemption category ids.
*
@@ -161,4 +195,44 @@ public class ClassificationAspectProperties
{
this.exemptionCategoryIds = ImmutableSet.copyOf(exemptionCategoryIds);
}
/**
* The user name (free form value) who reclassified the previously classified content
*
* @return the lastReclassifyBy The user name who reclassified the content
*/
public String getLastReclassifyBy()
{
return this.lastReclassifyBy;
}
/**
* The user name (free form value) who is reclassifying the previously classified content
*
* @param lastReclassifyBy the lastReclassifyBy to set
*/
public void setLastReclassifyBy(String lastReclassifyBy)
{
this.lastReclassifyBy = lastReclassifyBy;
}
/**
* The reclassification reason
*
* @return the lastReclassifyReason The reason for reclassification
*/
public String getLastReclassifyReason()
{
return this.lastReclassifyReason;
}
/**
* The reason for reclassification
*
* @param lastReclassifyReason the lastReclassifyReason to set
*/
public void setLastReclassifyReason(String lastReclassifyReason)
{
this.lastReclassifyReason = lastReclassifyReason;
}
}

View File

@@ -21,6 +21,7 @@ package org.alfresco.module.org_alfresco_module_rm.classification;
import static org.alfresco.module.org_alfresco_module_rm.classification.ClassificationLevelManager.UNCLASSIFIED_ID;
import static org.alfresco.module.org_alfresco_module_rm.util.RMParameterCheck.checkNotBlank;
import static org.alfresco.util.ParameterCheck.mandatory;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
import java.io.Serializable;
import java.util.HashMap;
@@ -173,18 +174,25 @@ public class ContentClassificationServiceImpl extends ServiceBaseImpl
propertiesMap.put(PROP_CURRENT_CLASSIFICATION, propertiesDTO.getClassificationLevelId());
propertiesMap.put(PROP_CLASSIFICATION_AGENCY, propertiesDTO.getClassificationAgency());
propertiesMap.put(PROP_CLASSIFIED_BY, propertiesDTO.getClassifiedBy());
HashSet<String> classificationReasons = new HashSet<>(propertiesDTO.getClassificationReasonIds());
propertiesMap.put(PROP_CLASSIFICATION_REASONS, classificationReasons);
propertiesMap.put(PROP_CLASSIFICATION_REASONS, new HashSet<>(propertiesDTO.getClassificationReasonIds()));
propertiesMap.put(PROP_DOWNGRADE_DATE, propertiesDTO.getDowngradeDate());
propertiesMap.put(PROP_DOWNGRADE_EVENT, propertiesDTO.getDowngradeEvent());
propertiesMap.put(PROP_DOWNGRADE_INSTRUCTIONS, propertiesDTO.getDowngradeInstructions());
propertiesMap.put(PROP_DECLASSIFICATION_DATE, propertiesDTO.getDeclassificationDate());
propertiesMap.put(PROP_DECLASSIFICATION_EVENT, propertiesDTO.getDeclassificationEvent());
propertiesMap.put(PROP_DECLASSIFICATION_EXEMPTIONS, new HashSet<>(propertiesDTO.getExemptionCategoryIds()));
HashSet<String> declassificationExemptions = new HashSet<>(propertiesDTO.getExemptionCategoryIds());
propertiesMap.put(PROP_DECLASSIFICATION_EXEMPTIONS, declassificationExemptions);
String lastReclassifyBy = propertiesDTO.getLastReclassifyBy();
if (isNotBlank(lastReclassifyBy))
{
propertiesMap.put(PROP_LAST_RECLASSIFY_BY, lastReclassifyBy);
}
String lastReclassifyReason = propertiesDTO.getLastReclassifyReason();
if (isNotBlank(lastReclassifyReason))
{
propertiesMap.put(PROP_LAST_RECLASSIFY_REASON, lastReclassifyReason);
}
return propertiesMap;
}

View File

@@ -63,6 +63,8 @@ public abstract class ClassifyContentBase extends AbstractRmWebScript
public static final String DECLASSIFICATION_DATE = "declassificationDate";
public static final String DECLASSIFICATION_EVENT = "declassificationEvent";
public static final String DECLASSIFICATION_EXEMPTIONS = "declassificationExemptions";
public static final String LAST_RECLASSIFY_BY = "lastReclassifyBy";
public static final String LAST_RECLASSIFY_REASON = "lastReclassifyReason";
/** The service responsible for classifying content. */
private ContentClassificationService contentClassificationService;
@@ -115,6 +117,8 @@ public abstract class ClassifyContentBase extends AbstractRmWebScript
Object declassificationDate = jsonObject.isNull(DECLASSIFICATION_DATE) ? null : getStringValueFromJSONObject(jsonObject, DECLASSIFICATION_DATE, false, false);
String declassificationEvent = getStringValueFromJSONObject(jsonObject, DECLASSIFICATION_EVENT, false, false);
Set<String> exemptionCategoryIds = getExemptionCategoryIds(jsonObject);
String lastReclassifyBy = getStringValueFromJSONObject(jsonObject, LAST_RECLASSIFY_BY, false, false);
String lastReclassifyReason = getStringValueFromJSONObject(jsonObject, LAST_RECLASSIFY_REASON, false, false);
ClassificationAspectProperties propertiesDTO = new ClassificationAspectProperties();
propertiesDTO.setClassificationLevelId(classificationLevelId);
@@ -127,6 +131,8 @@ public abstract class ClassifyContentBase extends AbstractRmWebScript
propertiesDTO.setDeclassificationDate(parseDate(declassificationDate));
propertiesDTO.setDeclassificationEvent(declassificationEvent);
propertiesDTO.setExemptionCategoryIds(exemptionCategoryIds);
propertiesDTO.setLastReclassifyBy(lastReclassifyBy);
propertiesDTO.setLastReclassifyReason(lastReclassifyReason);
NodeRef document = parseRequestForNodeRef(req);