mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ACS-8036] [FE] Legal Hold in ADW. Part 2 (Bulk) (#10062)
* ACS-8329 Manage bulks endpoint (#9972) * ACS-8325 extend ContentActionRef with tooltip (#9998) * [ACS-8425] Add functionality to select folder and assign it to a hold (#10011) * ACS-8425 add bulkFolderHold method * ACS-8425 refactor names and add more specific query to folder * ACS-8425 refactor names * ACS-8425 fix description in md file * ACS-8425 update interfaces and add constant * ACS-8425 fix readme file and refactor tests * ACS-8425 fix readme * ACS-8425 fix readme * ACS-8036 fix import path --------- Co-authored-by: Tomasz Nastaly <tomasz.nastaly@hyland.com>
This commit is contained in:
@@ -42,3 +42,4 @@ export * from './src/to-deprecate/alfresco-api-type';
|
||||
export * from './src/api-clients/api-client';
|
||||
export * from './src/api-clients/http-client.interface';
|
||||
export * from './src/utils';
|
||||
export * from './src/constants';
|
||||
|
@@ -19,6 +19,8 @@ import { BaseApi } from './base.api';
|
||||
import { throwIfNotDefined } from '../../../assert';
|
||||
import { ContentPagingQuery } from '../../content-rest-api';
|
||||
import { HoldBody, HoldEntry, HoldPaging } from './../model';
|
||||
import { BulkAssignHoldResponse } from '../model/bulkAssignHoldResponse';
|
||||
import { RequestQuery } from '../../search-rest-api';
|
||||
|
||||
/**
|
||||
* Legal Holds service.
|
||||
@@ -153,4 +155,25 @@ export class LegalHoldApi extends BaseApi {
|
||||
returnType: HoldPaging
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Start the asynchronous bulk process for a hold with id holdId based on search query results.
|
||||
*
|
||||
* @param holdId The identifier of a hold
|
||||
* @param query Search query
|
||||
* @returns Promise<BulkAssignHoldResponse>
|
||||
*/
|
||||
bulkAssignHold(holdId: string, query: RequestQuery): Promise<BulkAssignHoldResponse> {
|
||||
throwIfNotDefined(holdId, 'holdId');
|
||||
throwIfNotDefined(query, 'query');
|
||||
|
||||
return this.post({
|
||||
path: `/holds/{holdId}/bulk`,
|
||||
pathParams: { holdId },
|
||||
bodyParam: {
|
||||
query,
|
||||
op: 'ADD'
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,17 @@
|
||||
# BulkAssignHoldResponse
|
||||
|
||||
## Basic usage
|
||||
|
||||
```ts
|
||||
export interface BulkAssignHoldResponse {
|
||||
bulkStatusId: string;
|
||||
totalItems: number;
|
||||
}
|
||||
```
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Default value | Description |
|
||||
| ---------------- | ---------- | ------------- | ---------------------------------------- |
|
||||
| **bulkStatusId** | **string** | | Indentifier of Bulk Status |
|
||||
| **totalItems** | **number** | **0** | Amount of total nodes assigned to a hold |
|
@@ -8,8 +8,9 @@ All URIs are relative to _https://localhost/alfresco/api/-default-/public/gs/ver
|
||||
| [**assignHold**](LegalHoldApi.md#assignHold) | **POST** /holds/{holdId}/children | Assign node to legal hold |
|
||||
| [**assignHolds**](LegalHoldApi.md#assignHolds) | **POST** /holds/{holdId}/children | Assign nodes to legal hold |
|
||||
| [**unassignHold**](LegalHoldApi.md#unassignHold) | **DELETE** /holds/{holdId}/children/{nodeId} | Unassign node from legal hold |
|
||||
[**createHold**](LegalHoldApi.md#createHold) | **POST** /file-plans/{filePlanId}/holds | Create one hold
|
||||
[**createHolds**](LegalHoldApi.md#createHolds) | **POST** /file-plans/{filePlanId}/holds | Create list of holds
|
||||
| [**createHold**](LegalHoldApi.md#createHold) | **POST** /file-plans/{filePlanId}/holds | Create one hold |
|
||||
| [**createHolds**](LegalHoldApi.md#createHolds) | **POST** /file-plans/{filePlanId}/holds | Create list of holds |
|
||||
| [**bulkAssignHold**](LegalHoldApi.md#bulkAssignHold) | **POST** /holds/{holdId}/bulk | Bulk add of nodes to the hold |
|
||||
|
||||
<a name="getHolds"></a>
|
||||
|
||||
@@ -133,7 +134,7 @@ legalHoldApi.assignHolds([{ id: 'foo' }, { id: 'bar' }], 'holdId').then(
|
||||
### Parameters
|
||||
|
||||
| Name | Type | Default value | Description |
|
||||
| ----------- |----------------------| ------------- | ---------------------------------------------------- |
|
||||
| ----------- | -------------------- | ------------- | ---------------------------------------------------- |
|
||||
| **nodeIds** | **{ id: string }[]** | | The list with id of nodes to assign to existing hold |
|
||||
| **holdId** | **string** | | The identifier of a hold. |
|
||||
|
||||
@@ -184,7 +185,9 @@ legalHoldApi.unassignHold('holdId', 'nodeId').then(
|
||||
**void**
|
||||
|
||||
<a name="createHold"></a>
|
||||
|
||||
# **createHold**
|
||||
|
||||
> HoldEntry createHold(filePlanId, holds)
|
||||
|
||||
Create legal hold.
|
||||
@@ -202,33 +205,35 @@ this.alfrescoApi.setConfig({
|
||||
|
||||
const legalHoldApi = new LegalHoldApi(this.alfrescoApi);
|
||||
|
||||
const hold = {
|
||||
name: 'Hold 1',
|
||||
reason: 'Reason 1'
|
||||
const hold = {
|
||||
name: 'Hold 1',
|
||||
reason: 'Reason 1'
|
||||
};
|
||||
|
||||
legalHoldApi.createHold('-filePlan-', hold).then((data) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}, function(error) {
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
legalHoldApi.createHold('-filePlan-', hold).then(
|
||||
(data) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
},
|
||||
function (error) {
|
||||
console.error(error);
|
||||
}
|
||||
);
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Default value | Description
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**filePlanId** | **string** | | The site details
|
||||
**hold** | **Hold**| | Hold to create.
|
||||
| Name | Type | Default value | Description |
|
||||
| -------------- | ---------- | ------------- | ---------------- |
|
||||
| **filePlanId** | **string** | | The site details |
|
||||
| **hold** | **Hold** | | Hold to create. |
|
||||
|
||||
### Return type
|
||||
|
||||
[**HoldEntry**](./HoldEntry.md)
|
||||
|
||||
<a name="createHolds"></a>
|
||||
|
||||
# **createHolds**
|
||||
> HoldPaging createHolds(filePlanId, holds)
|
||||
|
||||
Create legal holds list.
|
||||
|
||||
@@ -245,8 +250,8 @@ this.alfrescoApi.setConfig({
|
||||
|
||||
const legalHoldApi = new LegalHoldApi(this.alfrescoApi);
|
||||
|
||||
let opts = [
|
||||
{
|
||||
let holds = [
|
||||
{
|
||||
name: 'Hold 1',
|
||||
reason: 'Reason 1'
|
||||
},
|
||||
@@ -257,21 +262,65 @@ let opts = [
|
||||
}
|
||||
];
|
||||
|
||||
legalHoldApi.createHolds('-filePlan-', holds).then((data) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}, function(error) {
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
legalHoldApi.createHolds('-filePlan-', holds).then(
|
||||
(data) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
},
|
||||
function (error) {
|
||||
console.error(error);
|
||||
}
|
||||
);
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Default value | Description
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**filePlanId** | **string** | | The site details
|
||||
**holds** | **Hold[]**| | Array of new holds.
|
||||
| Name | Type | Default value | Description |
|
||||
| -------------- | ---------- | ------------- | ------------------- |
|
||||
| **filePlanId** | **string** | | The site details |
|
||||
| **holds** | **Hold[]** | | Array of new holds. |
|
||||
|
||||
### Return type
|
||||
|
||||
[**HoldPaging**](./HoldPaging.md)
|
||||
|
||||
<a name="bulkAssignHold"></a>
|
||||
|
||||
# **bulkAssignHold**
|
||||
|
||||
> BulkAssignHoldResponse bulkAssignHold(holdId, query)
|
||||
|
||||
Start the asynchronous bulk process for a hold with id `holdId` based on search query results.
|
||||
|
||||
### Example
|
||||
|
||||
```javascript
|
||||
import LegalHoldApi from 'LegalHoldApi';
|
||||
import { AlfrescoApi } from '@alfresco/js-api';
|
||||
|
||||
this.alfrescoApi = new AlfrescoApi();
|
||||
this.alfrescoApi.setConfig({
|
||||
hostEcm: 'http://127.0.0.1:8080'
|
||||
});
|
||||
|
||||
const legalHoldApi = new LegalHoldApi(this.alfrescoApi);
|
||||
|
||||
legalHoldApi.bulkAssignHold('holdId', { query: 'SITE:swsdp and TYPE:content', language: 'afts' }).then(
|
||||
(data) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
},
|
||||
function (error) {
|
||||
console.error(error);
|
||||
}
|
||||
);
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
| Name | Type | Default value | Description |
|
||||
| ------------ | ---------- | ------------- | ------------------------ |
|
||||
| **holdId** | **string** | | The identifier of a hold |
|
||||
| **query** | **RequestQuery** | | Search query. |
|
||||
|
||||
### Return type
|
||||
|
||||
[**BulkAssignHoldResponse**](./BulkAssignHoldResponse.md)
|
||||
|
@@ -0,0 +1,21 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export interface BulkAssignHoldResponse {
|
||||
bulkStatusId: string;
|
||||
totalItems: number;
|
||||
}
|
@@ -79,3 +79,4 @@ export * from './holdBody';
|
||||
export * from './holdEntry';
|
||||
export * from './holdPaging';
|
||||
export * from './holdPagingList';
|
||||
export * from './bulkAssignHoldResponse';
|
||||
|
18
lib/js-api/src/constants/index.ts
Normal file
18
lib/js-api/src/constants/index.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export * from './language.constants';
|
22
lib/js-api/src/constants/language.constants.ts
Normal file
22
lib/js-api/src/constants/language.constants.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export const SEARCH_LANGUAGE = {
|
||||
AFTS: 'afts',
|
||||
LUCENE: 'lucene',
|
||||
CMIS: 'cmis'
|
||||
};
|
@@ -42,3 +42,4 @@ export * from './to-deprecate/alfresco-api-type';
|
||||
export * from './api-clients/api-client';
|
||||
export * from './api-clients/http-client.interface';
|
||||
export * from './utils';
|
||||
export * from './constants';
|
||||
|
@@ -17,6 +17,7 @@
|
||||
|
||||
import nock from 'nock';
|
||||
import { BaseMock } from '../base.mock';
|
||||
import { SEARCH_LANGUAGE } from '@alfresco/js-api';
|
||||
|
||||
export class SearchMock extends BaseMock {
|
||||
get200Response(): void {
|
||||
@@ -24,7 +25,7 @@ export class SearchMock extends BaseMock {
|
||||
.post('/alfresco/api/-default-/public/search/versions/1/search', {
|
||||
query: {
|
||||
query: 'select * from cmis:folder',
|
||||
language: 'cmis'
|
||||
language: SEARCH_LANGUAGE.CMIS
|
||||
}
|
||||
})
|
||||
.reply(200, {
|
||||
|
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import assert from 'assert';
|
||||
import { AlfrescoApi, SearchApi } from '../src';
|
||||
import { AlfrescoApi, SEARCH_LANGUAGE, SearchApi } from '../src';
|
||||
import { EcmAuthMock, SearchMock } from './mockObjects';
|
||||
|
||||
describe('Search', () => {
|
||||
@@ -50,7 +50,7 @@ describe('Search', () => {
|
||||
.search({
|
||||
query: {
|
||||
query: 'select * from cmis:folder',
|
||||
language: 'cmis'
|
||||
language: SEARCH_LANGUAGE.CMIS
|
||||
}
|
||||
})
|
||||
.then((data) => {
|
||||
|
Reference in New Issue
Block a user