[REPO-301] Support listing of secondary children Created: 13-Apr-16  Updated: 11-Jun-20  Resolved: 23-May-16

Status: Done
Project: Repository
Component/s: REST API
Affects Version/s: None
Fix Version/s: ACS 5.2

Type: Story Priority: Unprioritized
Reporter: Gavin Cornwell Assignee: Unassigned
Resolution: Done Votes: 0
Labels: triaged
Remaining Estimate: 0 minutes
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
relates to REPO-174 Support paging on peer association en... Open
relates to REPO-157 Support include of optional assocType... Done
relates to REPO-247 Create Secondary Child Association (m... Done
relates to REPO-278 Support include of optional isPrimary... Done
relates to REPO-347 List Folder Children Done
is related to by REPO-125 List Children / List Parents - optio... Done
Work Funnel: Feature
Epic Link: Initial Node REST API
Story Points: 3
Template:

 Description   

Summary Notes

This is an alternative to using /nodes/{parentId}/children but in this case only lists secondary children (not primary children).

GET /nodes/{parentId}/secondary-children [ ?where=(assocType='my:assocType') ]

Acceptance Criteria

  '/nodes/{parentId}/secondary-children':
    get:
      tags:
        - child associations
        - 5.2 changes
      summary: List secondary children
      description: |
        Returns a list of secondary child nodes that are associated with the current parent node, via a secondary child association.
      operationId: listSecondaryChildAssociations
      produces:
        - application/json
      parameters:
        - name: parentId
          in: path
          description: The identifier of a node.
          required: true
          type: string
        - name: assocType
          in: query
          description: Restrict the returned results to only those of the given association type
          type: string
          required: false 
        - name: where
          in: query
          description: |
            Optionally filter the list by assocType. Here's an example:

            *   where=(assocType='my:assoctype')
          required: false
          type: string          
        - $ref: '#/parameters/nodeAssocMinimalEntryIncludeParam'
        - $ref: '#/parameters/fieldsParam'
      responses:
        '200':
          description: Successful response
          schema:
            $ref: '#/definitions/NodeChildAssocPaging'
        '400':
          description: Invalid parameter, eg. unknown assocType
        '404':
          description: If **parentId** does not exist
        default:
          description: Error response
          schema:
            $ref: '#/definitions/Error'
definitions:
NodeChildAssocPaging:
    type: object
    properties:
      list:
        type: object
        properties:
          pagination:
            $ref: '#/definitions/Pagination'
          entries:
            type: array
            items:
              $ref: '#/definitions/NodeChildAssocMinimalEntry'
  NodeChildAssocMinimalEntry:
    type: object
    required:
      - entry
    properties:
      entry:
        $ref: '#/definitions/NodeChildAssocMinimal'
  NodeChildAssocMinimal:
    type: object
    properties:
      id:
        type: string
      parentId:
        type: string
      name:
        type: string
      nodeType:
        type: string
      isFolder:
        type: boolean
      isFile:
        type: boolean
      modifiedAt:
        type: string
        format: date-time
      modifiedByUser:
        $ref: '#/definitions/UserInfo'
      createdAt:
        type: string
        format: date-time
      createdByUser:
        $ref: '#/definitions/UserInfo'
      content:
        $ref: '#/definitions/ContentInfo'
      association:
        $ref: '#/definitions/ChildAssocInfo'
  ChildAssocInfo:
    type: object
    properties:
      assocType:
        type: string 
      isPrimary:
        type: boolean

Note: isPrimary will always be false here (since we're only listing secondary children)

Notes

  • it should be noted that "/secondary-children" could return more results that "/children?where=(isPrimary=false)" since the latter does not currently return the same child more than once (even if it has two or more secondary child association of different types). We may wish to change /children in the future although likely still an option to avoid name clash issues when being used for File/Folder scenarios

For live API spec, please see:



 Comments   
Comment by Gavin Cornwell [ 20-May-16 ]

Most of the functionality appears to be working, the API spec is present as are the automated tests.

However, according to the code (and tests) paging should be supported but it's not advertised in the API spec and does not appear to be working i.e. passing maxItems=1 does not restrict the result set. There should also be tests for this.

Comment by Gavin Cornwell [ 23-May-16 ]

Verified behaviour manually via Postman, verified OpenAPI spec now mentions paging parameters via API Explorer, verified automated tests are present and they pass in the build: https://bamboo.alfresco.com/bamboo/browse/ALF-EREPO31-OM-63/test/case/50544703

Generated at Thu Jul 09 10:14:39 BST 2020 using JIRA 7.6.3#76005-sha1:8a4e38d34af948780dbf52044e7aafb13a7cae58.