mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
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:
@@ -34,60 +34,82 @@ public class ClassificationAspectProperties
|
|||||||
{
|
{
|
||||||
/** The security clearance needed to access the content. */
|
/** The security clearance needed to access the content. */
|
||||||
private String classificationLevelId;
|
private String classificationLevelId;
|
||||||
|
|
||||||
/** Free-form text identifying who classified the content. */
|
/** Free-form text identifying who classified the content. */
|
||||||
private String classifiedBy;
|
private String classifiedBy;
|
||||||
|
|
||||||
/** The name of the agency responsible for the classification of this content. */
|
/** The name of the agency responsible for the classification of this content. */
|
||||||
private String classificationAgency;
|
private String classificationAgency;
|
||||||
|
|
||||||
/** A non-empty set of ids of reasons for classifying the content in this way. */
|
/** A non-empty set of ids of reasons for classifying the content in this way. */
|
||||||
private Set<String> classificationReasonIds = new HashSet<>();
|
private Set<String> classificationReasonIds = new HashSet<>();
|
||||||
|
|
||||||
/** If provided, this is the date of the next downgrade evaluation. */
|
/** If provided, this is the date of the next downgrade evaluation. */
|
||||||
private Date downgradeDate;
|
private Date downgradeDate;
|
||||||
|
|
||||||
/** If provided, this is the event at which the next downgrade evaluation will take place. */
|
/** If provided, this is the event at which the next downgrade evaluation will take place. */
|
||||||
private String downgradeEvent;
|
private String downgradeEvent;
|
||||||
|
|
||||||
/** If a downgrade date or event is given then this must be provided too with the instructions for the evaluation. */
|
/** If a downgrade date or event is given then this must be provided too with the instructions for the evaluation. */
|
||||||
private String downgradeInstructions;
|
private String downgradeInstructions;
|
||||||
|
|
||||||
/** If provided, this is the date of the next declassification evaluation. */
|
/** If provided, this is the date of the next declassification evaluation. */
|
||||||
private Date declassificationDate;
|
private Date declassificationDate;
|
||||||
|
|
||||||
/** If provided, this is the event at which the next declassification evaluation will take place. */
|
/** If provided, this is the event at which the next declassification evaluation will take place. */
|
||||||
private String declassificationEvent;
|
private String declassificationEvent;
|
||||||
|
|
||||||
/** An optional list of exemption category ids. */
|
/** An optional list of exemption category ids. */
|
||||||
private Set<String> exemptionCategoryIds = new HashSet<>();
|
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. */
|
/** @return The security clearance needed to access the content. */
|
||||||
public String getClassificationLevelId()
|
public String getClassificationLevelId()
|
||||||
{
|
{
|
||||||
return classificationLevelId;
|
return classificationLevelId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @param classificationLevelId The security clearance needed to access the content. */
|
/** @param classificationLevelId The security clearance needed to access the content. */
|
||||||
public void setClassificationLevelId(String classificationLevelId)
|
public void setClassificationLevelId(String classificationLevelId)
|
||||||
{
|
{
|
||||||
this.classificationLevelId = classificationLevelId;
|
this.classificationLevelId = classificationLevelId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return Free-form text identifying who classified the content. */
|
/** @return Free-form text identifying who classified the content. */
|
||||||
public String getClassifiedBy()
|
public String getClassifiedBy()
|
||||||
{
|
{
|
||||||
return classifiedBy;
|
return classifiedBy;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @param classifiedBy Free-form text identifying who classified the content. */
|
/** @param classifiedBy Free-form text identifying who classified the content. */
|
||||||
public void setClassifiedBy(String classifiedBy)
|
public void setClassifiedBy(String classifiedBy)
|
||||||
{
|
{
|
||||||
this.classifiedBy = classifiedBy;
|
this.classifiedBy = classifiedBy;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return The name of the agency responsible for the classification of this content. */
|
/** @return The name of the agency responsible for the classification of this content. */
|
||||||
public String getClassificationAgency()
|
public String getClassificationAgency()
|
||||||
{
|
{
|
||||||
return classificationAgency;
|
return classificationAgency;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @param classificationAgency The name of the agency responsible for the classification of this content. */
|
/** @param classificationAgency The name of the agency responsible for the classification of this content. */
|
||||||
public void setClassificationAgency(String classificationAgency)
|
public void setClassificationAgency(String classificationAgency)
|
||||||
{
|
{
|
||||||
this.classificationAgency = classificationAgency;
|
this.classificationAgency = classificationAgency;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return A non-empty set of ids of reasons for classifying the content in this way. */
|
/** @return A non-empty set of ids of reasons for classifying the content in this way. */
|
||||||
public Set<String> getClassificationReasonIds()
|
public Set<String> getClassificationReasonIds()
|
||||||
{
|
{
|
||||||
return classificationReasonIds;
|
return classificationReasonIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Store an immutable copy of the given set of classification reason ids.
|
* Store an immutable copy of the given set of classification reason ids.
|
||||||
*
|
*
|
||||||
@@ -97,61 +119,73 @@ public class ClassificationAspectProperties
|
|||||||
{
|
{
|
||||||
this.classificationReasonIds = ImmutableSet.copyOf(classificationReasonIds);
|
this.classificationReasonIds = ImmutableSet.copyOf(classificationReasonIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return If provided, this is the date of the next downgrade evaluation. */
|
/** @return If provided, this is the date of the next downgrade evaluation. */
|
||||||
public Date getDowngradeDate()
|
public Date getDowngradeDate()
|
||||||
{
|
{
|
||||||
return downgradeDate;
|
return downgradeDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @param downgradeDate If provided, this is the date of the next downgrade evaluation. */
|
/** @param downgradeDate If provided, this is the date of the next downgrade evaluation. */
|
||||||
public void setDowngradeDate(Date downgradeDate)
|
public void setDowngradeDate(Date downgradeDate)
|
||||||
{
|
{
|
||||||
this.downgradeDate = downgradeDate;
|
this.downgradeDate = downgradeDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return If provided, this is the event at which the next downgrade evaluation will take place. */
|
/** @return If provided, this is the event at which the next downgrade evaluation will take place. */
|
||||||
public String getDowngradeEvent()
|
public String getDowngradeEvent()
|
||||||
{
|
{
|
||||||
return downgradeEvent;
|
return downgradeEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @param downgradeEvent If provided, this is the event at which the next downgrade evaluation will take place. */
|
/** @param downgradeEvent If provided, this is the event at which the next downgrade evaluation will take place. */
|
||||||
public void setDowngradeEvent(String downgradeEvent)
|
public void setDowngradeEvent(String downgradeEvent)
|
||||||
{
|
{
|
||||||
this.downgradeEvent = 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. */
|
/** @return If a downgrade date or event is given then this must be provided too with the instructions for the evaluation. */
|
||||||
public String getDowngradeInstructions()
|
public String getDowngradeInstructions()
|
||||||
{
|
{
|
||||||
return downgradeInstructions;
|
return downgradeInstructions;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @param downgradeInstructions If a downgrade date or event is given then this must be provided too with the instructions for the evaluation. */
|
/** @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)
|
public void setDowngradeInstructions(String downgradeInstructions)
|
||||||
{
|
{
|
||||||
this.downgradeInstructions = downgradeInstructions;
|
this.downgradeInstructions = downgradeInstructions;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return If provided, this is the date of the next declassification evaluation. */
|
/** @return If provided, this is the date of the next declassification evaluation. */
|
||||||
public Date getDeclassificationDate()
|
public Date getDeclassificationDate()
|
||||||
{
|
{
|
||||||
return declassificationDate;
|
return declassificationDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @param declassificationDate If provided, this is the date of the next declassification evaluation. */
|
/** @param declassificationDate If provided, this is the date of the next declassification evaluation. */
|
||||||
public void setDeclassificationDate(Date declassificationDate)
|
public void setDeclassificationDate(Date declassificationDate)
|
||||||
{
|
{
|
||||||
this.declassificationDate = declassificationDate;
|
this.declassificationDate = declassificationDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return If provided, this is the event at which the next declassification evaluation will take place. */
|
/** @return If provided, this is the event at which the next declassification evaluation will take place. */
|
||||||
public String getDeclassificationEvent()
|
public String getDeclassificationEvent()
|
||||||
{
|
{
|
||||||
return declassificationEvent;
|
return declassificationEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @param declassificationEvent If provided, this is the event at which the next declassification evaluation will take place. */
|
/** @param declassificationEvent If provided, this is the event at which the next declassification evaluation will take place. */
|
||||||
public void setDeclassificationEvent(String declassificationEvent)
|
public void setDeclassificationEvent(String declassificationEvent)
|
||||||
{
|
{
|
||||||
this.declassificationEvent = declassificationEvent;
|
this.declassificationEvent = declassificationEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return This is an optional list of exemption category ids. */
|
/** @return This is an optional list of exemption category ids. */
|
||||||
public Set<String> getExemptionCategoryIds()
|
public Set<String> getExemptionCategoryIds()
|
||||||
{
|
{
|
||||||
return exemptionCategoryIds;
|
return exemptionCategoryIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Store an immutable copy of the given set of exemption category ids.
|
* Store an immutable copy of the given set of exemption category ids.
|
||||||
*
|
*
|
||||||
@@ -161,4 +195,44 @@ public class ClassificationAspectProperties
|
|||||||
{
|
{
|
||||||
this.exemptionCategoryIds = ImmutableSet.copyOf(exemptionCategoryIds);
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -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.classification.ClassificationLevelManager.UNCLASSIFIED_ID;
|
||||||
import static org.alfresco.module.org_alfresco_module_rm.util.RMParameterCheck.checkNotBlank;
|
import static org.alfresco.module.org_alfresco_module_rm.util.RMParameterCheck.checkNotBlank;
|
||||||
import static org.alfresco.util.ParameterCheck.mandatory;
|
import static org.alfresco.util.ParameterCheck.mandatory;
|
||||||
|
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -173,18 +174,25 @@ public class ContentClassificationServiceImpl extends ServiceBaseImpl
|
|||||||
propertiesMap.put(PROP_CURRENT_CLASSIFICATION, propertiesDTO.getClassificationLevelId());
|
propertiesMap.put(PROP_CURRENT_CLASSIFICATION, propertiesDTO.getClassificationLevelId());
|
||||||
propertiesMap.put(PROP_CLASSIFICATION_AGENCY, propertiesDTO.getClassificationAgency());
|
propertiesMap.put(PROP_CLASSIFICATION_AGENCY, propertiesDTO.getClassificationAgency());
|
||||||
propertiesMap.put(PROP_CLASSIFIED_BY, propertiesDTO.getClassifiedBy());
|
propertiesMap.put(PROP_CLASSIFIED_BY, propertiesDTO.getClassifiedBy());
|
||||||
|
propertiesMap.put(PROP_CLASSIFICATION_REASONS, new HashSet<>(propertiesDTO.getClassificationReasonIds()));
|
||||||
HashSet<String> classificationReasons = new HashSet<>(propertiesDTO.getClassificationReasonIds());
|
|
||||||
propertiesMap.put(PROP_CLASSIFICATION_REASONS, classificationReasons);
|
|
||||||
|
|
||||||
propertiesMap.put(PROP_DOWNGRADE_DATE, propertiesDTO.getDowngradeDate());
|
propertiesMap.put(PROP_DOWNGRADE_DATE, propertiesDTO.getDowngradeDate());
|
||||||
propertiesMap.put(PROP_DOWNGRADE_EVENT, propertiesDTO.getDowngradeEvent());
|
propertiesMap.put(PROP_DOWNGRADE_EVENT, propertiesDTO.getDowngradeEvent());
|
||||||
propertiesMap.put(PROP_DOWNGRADE_INSTRUCTIONS, propertiesDTO.getDowngradeInstructions());
|
propertiesMap.put(PROP_DOWNGRADE_INSTRUCTIONS, propertiesDTO.getDowngradeInstructions());
|
||||||
propertiesMap.put(PROP_DECLASSIFICATION_DATE, propertiesDTO.getDeclassificationDate());
|
propertiesMap.put(PROP_DECLASSIFICATION_DATE, propertiesDTO.getDeclassificationDate());
|
||||||
propertiesMap.put(PROP_DECLASSIFICATION_EVENT, propertiesDTO.getDeclassificationEvent());
|
propertiesMap.put(PROP_DECLASSIFICATION_EVENT, propertiesDTO.getDeclassificationEvent());
|
||||||
|
propertiesMap.put(PROP_DECLASSIFICATION_EXEMPTIONS, new HashSet<>(propertiesDTO.getExemptionCategoryIds()));
|
||||||
|
|
||||||
HashSet<String> declassificationExemptions = new HashSet<>(propertiesDTO.getExemptionCategoryIds());
|
String lastReclassifyBy = propertiesDTO.getLastReclassifyBy();
|
||||||
propertiesMap.put(PROP_DECLASSIFICATION_EXEMPTIONS, declassificationExemptions);
|
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;
|
return propertiesMap;
|
||||||
}
|
}
|
||||||
|
@@ -63,6 +63,8 @@ public abstract class ClassifyContentBase extends AbstractRmWebScript
|
|||||||
public static final String DECLASSIFICATION_DATE = "declassificationDate";
|
public static final String DECLASSIFICATION_DATE = "declassificationDate";
|
||||||
public static final String DECLASSIFICATION_EVENT = "declassificationEvent";
|
public static final String DECLASSIFICATION_EVENT = "declassificationEvent";
|
||||||
public static final String DECLASSIFICATION_EXEMPTIONS = "declassificationExemptions";
|
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. */
|
/** The service responsible for classifying content. */
|
||||||
private ContentClassificationService contentClassificationService;
|
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);
|
Object declassificationDate = jsonObject.isNull(DECLASSIFICATION_DATE) ? null : getStringValueFromJSONObject(jsonObject, DECLASSIFICATION_DATE, false, false);
|
||||||
String declassificationEvent = getStringValueFromJSONObject(jsonObject, DECLASSIFICATION_EVENT, false, false);
|
String declassificationEvent = getStringValueFromJSONObject(jsonObject, DECLASSIFICATION_EVENT, false, false);
|
||||||
Set<String> exemptionCategoryIds = getExemptionCategoryIds(jsonObject);
|
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();
|
ClassificationAspectProperties propertiesDTO = new ClassificationAspectProperties();
|
||||||
propertiesDTO.setClassificationLevelId(classificationLevelId);
|
propertiesDTO.setClassificationLevelId(classificationLevelId);
|
||||||
@@ -127,6 +131,8 @@ public abstract class ClassifyContentBase extends AbstractRmWebScript
|
|||||||
propertiesDTO.setDeclassificationDate(parseDate(declassificationDate));
|
propertiesDTO.setDeclassificationDate(parseDate(declassificationDate));
|
||||||
propertiesDTO.setDeclassificationEvent(declassificationEvent);
|
propertiesDTO.setDeclassificationEvent(declassificationEvent);
|
||||||
propertiesDTO.setExemptionCategoryIds(exemptionCategoryIds);
|
propertiesDTO.setExemptionCategoryIds(exemptionCategoryIds);
|
||||||
|
propertiesDTO.setLastReclassifyBy(lastReclassifyBy);
|
||||||
|
propertiesDTO.setLastReclassifyReason(lastReclassifyReason);
|
||||||
|
|
||||||
NodeRef document = parseRequestForNodeRef(req);
|
NodeRef document = parseRequestForNodeRef(req);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user