mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-5087 - Updated include params; added association for records
This commit is contained in:
@@ -40,6 +40,7 @@ import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedul
|
|||||||
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService;
|
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
||||||
import org.alfresco.rest.api.Nodes;
|
import org.alfresco.rest.api.Nodes;
|
||||||
|
import org.alfresco.rest.api.model.AssocChild;
|
||||||
import org.alfresco.rest.api.model.ContentInfo;
|
import org.alfresco.rest.api.model.ContentInfo;
|
||||||
import org.alfresco.rest.api.model.Node;
|
import org.alfresco.rest.api.model.Node;
|
||||||
import org.alfresco.rest.api.model.UserInfo;
|
import org.alfresco.rest.api.model.UserInfo;
|
||||||
@@ -61,7 +62,9 @@ import org.alfresco.rm.rest.api.model.UnfiledRecordFolder;
|
|||||||
import org.alfresco.rm.rest.api.model.UnfiledRecordFolderChild;
|
import org.alfresco.rm.rest.api.model.UnfiledRecordFolderChild;
|
||||||
import org.alfresco.service.ServiceRegistry;
|
import org.alfresco.service.ServiceRegistry;
|
||||||
import org.alfresco.service.cmr.model.FileInfo;
|
import org.alfresco.service.cmr.model.FileInfo;
|
||||||
|
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||||
import org.alfresco.service.cmr.repository.ContentData;
|
import org.alfresco.service.cmr.repository.ContentData;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
import org.alfresco.service.cmr.security.PersonService;
|
import org.alfresco.service.cmr.security.PersonService;
|
||||||
import org.alfresco.service.namespace.NamespaceService;
|
import org.alfresco.service.namespace.NamespaceService;
|
||||||
@@ -600,6 +603,48 @@ public class ApiNodesModelFactory
|
|||||||
return nodes.mapFromNodeProperties(properties, new ArrayList<>(), new HashMap<>(), EXCLUDED_NS, EXCLUDED_PROPS);
|
return nodes.mapFromNodeProperties(properties, new ArrayList<>(), new HashMap<>(), EXCLUDED_NS, EXCLUDED_PROPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Utility method that maps associations, applicable only for records
|
||||||
|
*
|
||||||
|
* @param rmNode
|
||||||
|
* @param info
|
||||||
|
* @param includeParam
|
||||||
|
*/
|
||||||
|
private void mapAssociations(RMNode rmNode, FileInfo info, List<String> includeParam)
|
||||||
|
{
|
||||||
|
if (includeParam.contains(RMNode.PARAM_INCLUDE_ASSOCIATION))
|
||||||
|
{
|
||||||
|
NodeRef nodeRef = info.getNodeRef();
|
||||||
|
ChildAssociationRef parentAssocRef = nodeService.getPrimaryParent(nodeRef);
|
||||||
|
|
||||||
|
if ((parentAssocRef == null) || (parentAssocRef.getParentRef() == null)
|
||||||
|
|| (!parentAssocRef.getParentRef().equals(rmNode.getParentId())))
|
||||||
|
{
|
||||||
|
List<ChildAssociationRef> parentAssocRefs = nodeService.getParentAssocs(nodeRef);
|
||||||
|
for (ChildAssociationRef pAssocRef : parentAssocRefs)
|
||||||
|
{
|
||||||
|
if (pAssocRef.getParentRef().equals(rmNode.getParentId()))
|
||||||
|
{
|
||||||
|
// for now, assume same parent/child cannot appear more than once (due to unique name)
|
||||||
|
parentAssocRef = pAssocRef;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parentAssocRef != null)
|
||||||
|
{
|
||||||
|
QName assocTypeQName = parentAssocRef.getTypeQName();
|
||||||
|
if ((assocTypeQName != null) && (!EXCLUDED_NS.contains(assocTypeQName.getNamespaceURI())))
|
||||||
|
{
|
||||||
|
AssocChild childAssoc = new AssocChild(assocTypeQName.toPrefixString(namespaceService), parentAssocRef.isPrimary());
|
||||||
|
|
||||||
|
rmNode.setAssociation(childAssoc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an object of type FilePlan
|
* Creates an object of type FilePlan
|
||||||
*
|
*
|
||||||
@@ -760,6 +805,10 @@ public class ApiNodesModelFactory
|
|||||||
mapBasicInfo(unfiledContainerChild, info, parameters.getFilter(), mapUserInfo, isMinimalInfo);
|
mapBasicInfo(unfiledContainerChild, info, parameters.getFilter(), mapUserInfo, isMinimalInfo);
|
||||||
mapOptionalInfo(unfiledContainerChild, info, parameters.getInclude(), isMinimalInfo);
|
mapOptionalInfo(unfiledContainerChild, info, parameters.getInclude(), isMinimalInfo);
|
||||||
mapUnfiledChildInfo(unfiledContainerChild, info, parameters.getFilter());
|
mapUnfiledChildInfo(unfiledContainerChild, info, parameters.getFilter());
|
||||||
|
if (unfiledContainerChild.getIsRecord())
|
||||||
|
{
|
||||||
|
mapAssociations(unfiledContainerChild, info, parameters.getInclude());
|
||||||
|
}
|
||||||
return unfiledContainerChild;
|
return unfiledContainerChild;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -797,6 +846,10 @@ public class ApiNodesModelFactory
|
|||||||
mapBasicInfo(unfiledRecordFolderChild, info, parameters.getFilter(), mapUserInfo, isMinimalInfo);
|
mapBasicInfo(unfiledRecordFolderChild, info, parameters.getFilter(), mapUserInfo, isMinimalInfo);
|
||||||
mapOptionalInfo(unfiledRecordFolderChild, info, parameters.getInclude(), isMinimalInfo);
|
mapOptionalInfo(unfiledRecordFolderChild, info, parameters.getInclude(), isMinimalInfo);
|
||||||
mapUnfiledChildInfo(unfiledRecordFolderChild, info, parameters.getFilter());
|
mapUnfiledChildInfo(unfiledRecordFolderChild, info, parameters.getFilter());
|
||||||
|
if (unfiledRecordFolderChild.getIsRecord())
|
||||||
|
{
|
||||||
|
mapAssociations(unfiledRecordFolderChild, info, parameters.getInclude());
|
||||||
|
}
|
||||||
return unfiledRecordFolderChild;
|
return unfiledRecordFolderChild;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -834,6 +887,7 @@ public class ApiNodesModelFactory
|
|||||||
mapBasicInfo(record, info, parameters.getFilter(), mapUserInfo, isMinimalInfo);
|
mapBasicInfo(record, info, parameters.getFilter(), mapUserInfo, isMinimalInfo);
|
||||||
mapOptionalInfo(record, info, parameters.getInclude(), isMinimalInfo);
|
mapOptionalInfo(record, info, parameters.getInclude(), isMinimalInfo);
|
||||||
mapRecordInfo(record, info, parameters.getInclude());
|
mapRecordInfo(record, info, parameters.getInclude());
|
||||||
|
mapAssociations(record, info, parameters.getInclude());
|
||||||
return record;
|
return record;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -31,6 +31,7 @@ import java.util.Date;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.alfresco.rest.api.model.Assoc;
|
||||||
import org.alfresco.rest.api.model.PathInfo;
|
import org.alfresco.rest.api.model.PathInfo;
|
||||||
import org.alfresco.rest.api.model.UserInfo;
|
import org.alfresco.rest.api.model.UserInfo;
|
||||||
import org.alfresco.rest.framework.resource.UniqueId;
|
import org.alfresco.rest.framework.resource.UniqueId;
|
||||||
@@ -65,6 +66,7 @@ public abstract class RMNode
|
|||||||
|
|
||||||
public static final String PARAM_HAS_RETENTION_SCHEDULE = "hasRetentionSchedule";
|
public static final String PARAM_HAS_RETENTION_SCHEDULE = "hasRetentionSchedule";
|
||||||
public static final String PARAM_IS_CLOSED = "isClosed";
|
public static final String PARAM_IS_CLOSED = "isClosed";
|
||||||
|
public static final String PARAM_INCLUDE_ASSOCIATION = "association";
|
||||||
|
|
||||||
public static final String FILE_PLAN_TYPE = "rma:filePlan";
|
public static final String FILE_PLAN_TYPE = "rma:filePlan";
|
||||||
public static final String RECORD_CATEGORY_TYPE = "rma:recordCategory";
|
public static final String RECORD_CATEGORY_TYPE = "rma:recordCategory";
|
||||||
@@ -94,6 +96,7 @@ public abstract class RMNode
|
|||||||
protected Map<String, Object> properties;
|
protected Map<String, Object> properties;
|
||||||
protected PathInfo path;
|
protected PathInfo path;
|
||||||
protected List<String> allowableOperations;
|
protected List<String> allowableOperations;
|
||||||
|
protected Assoc association;
|
||||||
|
|
||||||
public RMNode()
|
public RMNode()
|
||||||
{
|
{
|
||||||
@@ -221,4 +224,14 @@ public abstract class RMNode
|
|||||||
this.allowableOperations = allowableOperations;
|
this.allowableOperations = allowableOperations;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Assoc getAssociation()
|
||||||
|
{
|
||||||
|
return association;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAssociation(Assoc association)
|
||||||
|
{
|
||||||
|
this.association = association;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -538,7 +538,7 @@ paths:
|
|||||||
- $ref: '#/parameters/skipCountParam'
|
- $ref: '#/parameters/skipCountParam'
|
||||||
- $ref: '#/parameters/maxItemsParam'
|
- $ref: '#/parameters/maxItemsParam'
|
||||||
- $ref: '#/parameters/unfiledRecordFolderAndContainerWhereParam'
|
- $ref: '#/parameters/unfiledRecordFolderAndContainerWhereParam'
|
||||||
- $ref: '#/parameters/unfiledContainerEntryIncludeParam'
|
- $ref: '#/parameters/unfiledContainerChildEntryIncludeParam'
|
||||||
- $ref: '#/parameters/unfiledContainerIncludeSourceParam'
|
- $ref: '#/parameters/unfiledContainerIncludeSourceParam'
|
||||||
- $ref: '#/parameters/fieldsParam'
|
- $ref: '#/parameters/fieldsParam'
|
||||||
responses:
|
responses:
|
||||||
@@ -842,7 +842,7 @@ paths:
|
|||||||
- $ref: '#/parameters/skipCountParam'
|
- $ref: '#/parameters/skipCountParam'
|
||||||
- $ref: '#/parameters/maxItemsParam'
|
- $ref: '#/parameters/maxItemsParam'
|
||||||
- $ref: '#/parameters/unfiledRecordFolderAndContainerWhereParam'
|
- $ref: '#/parameters/unfiledRecordFolderAndContainerWhereParam'
|
||||||
- $ref: '#/parameters/unfiledRecordFolderEntryIncludeParam'
|
- $ref: '#/parameters/unfiledRecordFolderChildEntryIncludeParam'
|
||||||
- $ref: '#/parameters/unfiledRecordFolderRelativePathParam'
|
- $ref: '#/parameters/unfiledRecordFolderRelativePathParam'
|
||||||
- $ref: '#/parameters/unfiledRecordFolderIncludeSourceParam'
|
- $ref: '#/parameters/unfiledRecordFolderIncludeSourceParam'
|
||||||
- $ref: '#/parameters/fieldsParam'
|
- $ref: '#/parameters/fieldsParam'
|
||||||
@@ -2093,7 +2093,24 @@ parameters:
|
|||||||
description: |
|
description: |
|
||||||
Returns additional information about the unfiled records container children. Any optional field from the response model can be requested. For example:
|
Returns additional information about the unfiled records container children. Any optional field from the response model can be requested. For example:
|
||||||
* allowableOperations
|
* allowableOperations
|
||||||
|
* aspectNames
|
||||||
* path
|
* path
|
||||||
|
* properties
|
||||||
|
required: false
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
collectionFormat: csv
|
||||||
|
unfiledContainerChildEntryIncludeParam:
|
||||||
|
name: include
|
||||||
|
in: query
|
||||||
|
description: |
|
||||||
|
Returns additional information about the unfiled records container children. Any optional field from the response model can be requested. For example:
|
||||||
|
* allowableOperations
|
||||||
|
* aspectNames
|
||||||
|
* association
|
||||||
|
* path
|
||||||
|
* properties
|
||||||
required: false
|
required: false
|
||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
@@ -2119,7 +2136,24 @@ parameters:
|
|||||||
description: |
|
description: |
|
||||||
Returns additional information about the unfiled records container children. Any optional field from the response model can be requested. For example:
|
Returns additional information about the unfiled records container children. Any optional field from the response model can be requested. For example:
|
||||||
* allowableOperations
|
* allowableOperations
|
||||||
|
* aspectNames
|
||||||
* path
|
* path
|
||||||
|
* properties
|
||||||
|
required: false
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
collectionFormat: csv
|
||||||
|
unfiledRecordFolderChildEntryIncludeParam:
|
||||||
|
name: include
|
||||||
|
in: query
|
||||||
|
description: |
|
||||||
|
Returns additional information about the unfiled records container children. Any optional field from the response model can be requested. For example:
|
||||||
|
* allowableOperations
|
||||||
|
* aspectNames
|
||||||
|
* association
|
||||||
|
* path
|
||||||
|
* properties
|
||||||
required: false
|
required: false
|
||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
@@ -2165,9 +2199,11 @@ parameters:
|
|||||||
in: query
|
in: query
|
||||||
description: |
|
description: |
|
||||||
Returns additional information about the record category. Any optional field from the response model can be requested. For example:
|
Returns additional information about the record category. Any optional field from the response model can be requested. For example:
|
||||||
* hasRetentionSchedule
|
|
||||||
* allowableOperations
|
* allowableOperations
|
||||||
|
* aspectNames
|
||||||
|
* hasRetentionSchedule
|
||||||
* path
|
* path
|
||||||
|
* properties
|
||||||
required: false
|
required: false
|
||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
@@ -2191,14 +2227,14 @@ parameters:
|
|||||||
in: query
|
in: query
|
||||||
description: |
|
description: |
|
||||||
Returns additional information about the record category. Any optional field from the response model can be requested. For example:
|
Returns additional information about the record category. Any optional field from the response model can be requested. For example:
|
||||||
* properties
|
* allowableOperations
|
||||||
* aspectNames
|
* aspectNames
|
||||||
* hasRetentionSchedule
|
* hasRetentionSchedule
|
||||||
* isClosed
|
* isClosed
|
||||||
* isRecordCategory
|
* isRecordCategory
|
||||||
* isRecordFolder
|
* isRecordFolder
|
||||||
* allowableOperations
|
|
||||||
* path
|
* path
|
||||||
|
* properties
|
||||||
required: false
|
required: false
|
||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
@@ -2231,10 +2267,8 @@ parameters:
|
|||||||
in: query
|
in: query
|
||||||
description: |
|
description: |
|
||||||
Returns additional information about the record folders. Any optional field from the response model can be requested. For example:
|
Returns additional information about the record folders. Any optional field from the response model can be requested. For example:
|
||||||
* properties
|
|
||||||
* aspectNames
|
|
||||||
* isClosed
|
|
||||||
* allowableOperations
|
* allowableOperations
|
||||||
|
* isClosed
|
||||||
* path
|
* path
|
||||||
required: false
|
required: false
|
||||||
type: array
|
type: array
|
||||||
@@ -2252,11 +2286,13 @@ parameters:
|
|||||||
in: query
|
in: query
|
||||||
description: |
|
description: |
|
||||||
Returns additional information about the records. Any optional field from the response model can be requested. For example:
|
Returns additional information about the records. Any optional field from the response model can be requested. For example:
|
||||||
* properties
|
|
||||||
* aspectNames
|
|
||||||
* isCompleted
|
|
||||||
* allowableOperations
|
* allowableOperations
|
||||||
|
* aspectNames
|
||||||
|
* association
|
||||||
|
* content
|
||||||
|
* isCompleted
|
||||||
* path
|
* path
|
||||||
|
* properties
|
||||||
required: false
|
required: false
|
||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
@@ -2307,12 +2343,12 @@ parameters:
|
|||||||
in: query
|
in: query
|
||||||
description: |
|
description: |
|
||||||
Returns additional information about the transfer folder. Any optional field from the response model can be requested. For example:
|
Returns additional information about the transfer folder. Any optional field from the response model can be requested. For example:
|
||||||
|
* allowableOperations
|
||||||
|
* aspectNames
|
||||||
|
* properties
|
||||||
* transferPDFIndicator
|
* transferPDFIndicator
|
||||||
* transferLocation
|
* transferLocation
|
||||||
* transferAccessionIndicator
|
* transferAccessionIndicator
|
||||||
* properties
|
|
||||||
* aspectNames
|
|
||||||
* allowableOperations
|
|
||||||
required: false
|
required: false
|
||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
@@ -2335,14 +2371,14 @@ parameters:
|
|||||||
in: query
|
in: query
|
||||||
description: |
|
description: |
|
||||||
Returns additional information about the transfer's child. Any optional field from the response model can be requested. For example:
|
Returns additional information about the transfer's child. Any optional field from the response model can be requested. For example:
|
||||||
* properties
|
* allowableOperations
|
||||||
* aspectNames
|
* aspectNames
|
||||||
|
* isClosed
|
||||||
* isCompleted
|
* isCompleted
|
||||||
* isRecord
|
* isRecord
|
||||||
* isClosed
|
|
||||||
* isRecordFolder
|
* isRecordFolder
|
||||||
* allowableOperations
|
|
||||||
* path
|
* path
|
||||||
|
* properties
|
||||||
required: false
|
required: false
|
||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
@@ -2360,9 +2396,9 @@ parameters:
|
|||||||
in: query
|
in: query
|
||||||
description: |
|
description: |
|
||||||
Returns additional information about the record. Any optional field from the response model can be requested. For example:
|
Returns additional information about the record. Any optional field from the response model can be requested. For example:
|
||||||
* isCompleted
|
|
||||||
* content
|
|
||||||
* allowableOperations
|
* allowableOperations
|
||||||
|
* content
|
||||||
|
* isCompleted
|
||||||
* path
|
* path
|
||||||
required: false
|
required: false
|
||||||
type: array
|
type: array
|
||||||
@@ -2961,7 +2997,7 @@ definitions:
|
|||||||
items:
|
items:
|
||||||
$ref: '#/definitions/RecordCategoryChildAssociationEntry'
|
$ref: '#/definitions/RecordCategoryChildAssociationEntry'
|
||||||
source:
|
source:
|
||||||
$ref: '#/definitions/RecordCategory'
|
$ref: '#/definitions/FilePlan'
|
||||||
RecordCategoryChildAssociationEntry:
|
RecordCategoryChildAssociationEntry:
|
||||||
type: object
|
type: object
|
||||||
required:
|
required:
|
||||||
@@ -2973,9 +3009,6 @@ definitions:
|
|||||||
allOf:
|
allOf:
|
||||||
- $ref: '#/definitions/RecordCategoryChild'
|
- $ref: '#/definitions/RecordCategoryChild'
|
||||||
- type: object
|
- type: object
|
||||||
properties:
|
|
||||||
association:
|
|
||||||
$ref: '#/definitions/ChildAssociationInfo'
|
|
||||||
## Record folder
|
## Record folder
|
||||||
RecordFolder:
|
RecordFolder:
|
||||||
type: object
|
type: object
|
||||||
|
Reference in New Issue
Block a user