mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
ACS-8055 add documentation
This commit is contained in:
committed by
Darya Balvanovich
parent
bec33659fd
commit
af04b8d1d7
@@ -83,7 +83,10 @@ Accesses and manipulates ACS document nodes using their node IDs.
|
|||||||
- _nodeId:_ `string` - ID of the target node
|
- _nodeId:_ `string` - ID of the target node
|
||||||
- _nodeBody:_ `any` - New data for the node
|
- _nodeBody:_ `any` - New data for the node
|
||||||
- _options:_ `any` - Optional parameters supported by JS-API
|
- _options:_ `any` - Optional parameters supported by JS-API
|
||||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`MinimalNode`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeMinimalEntry.md)`>` - Updated node information
|
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`MinimalNode`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeMinimalEntry.md)`>` - Updated node information<br/>
|
||||||
|
Getting legal holds assigned to a node.
|
||||||
|
- _nodeId:_ `string` - ID of the target node
|
||||||
|
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`Hold[]`](../../../lib/js-api/src/api/gs-core-rest-api/docs/Hold.md)`>` - Updated node information
|
||||||
|
|
||||||
## Details
|
## Details
|
||||||
|
|
||||||
|
|||||||
@@ -38,21 +38,16 @@ export class LegalHoldService {
|
|||||||
*
|
*
|
||||||
* @param filePlanId The identifier of a file plan. You can also use the -filePlan- alias.
|
* @param filePlanId The identifier of a file plan. You can also use the -filePlan- alias.
|
||||||
* @param options Optional parameters supported by JS-API
|
* @param options Optional parameters supported by JS-API
|
||||||
* @returns List of assigned holds
|
* @returns List of assigned holds Hold[]
|
||||||
*/
|
*/
|
||||||
getHolds(filePlanId: string, options: ContentPagingQuery = {}): Observable<Hold[]> {
|
getHolds(filePlanId: string, options: ContentPagingQuery = {}): Observable<Hold[]> {
|
||||||
const queryOptions = Object.assign({
|
return from(this.legalHoldApi.getHolds(filePlanId, options)).pipe(
|
||||||
maxItems: options?.maxItems,
|
map(({ list }) =>
|
||||||
skipCount: options?.skipCount
|
list?.entries?.map(({ entry }) => ({
|
||||||
});
|
id: entry?.id,
|
||||||
|
name: entry?.name,
|
||||||
return from(this.legalHoldApi.getHolds(filePlanId, queryOptions)).pipe(
|
reason: entry?.reason,
|
||||||
map((holds) =>
|
description: entry?.description
|
||||||
holds.list?.entries?.map((entity) => ({
|
|
||||||
id: entity.entry.id,
|
|
||||||
name: entity.entry.name,
|
|
||||||
reason: entity.entry.reason,
|
|
||||||
description: entity.entry.description
|
|
||||||
}))
|
}))
|
||||||
),
|
),
|
||||||
catchError((err) => throwError(err))
|
catchError((err) => throwError(err))
|
||||||
|
|||||||
@@ -17,16 +17,56 @@
|
|||||||
|
|
||||||
import { TestBed } from '@angular/core/testing';
|
import { TestBed } from '@angular/core/testing';
|
||||||
import { LegalHoldService } from './legal-hold.service';
|
import { LegalHoldService } from './legal-hold.service';
|
||||||
|
import { ContentTestingModule } from '../../testing/content.testing.module';
|
||||||
|
import { Hold, NodeChildAssociationPaging } from '@alfresco/js-api';
|
||||||
|
|
||||||
describe('LegalHoldsService', () => {
|
describe('LegalHoldsService', () => {
|
||||||
let service: LegalHoldService;
|
let service: LegalHoldService;
|
||||||
|
let legalHolds: NodeChildAssociationPaging;
|
||||||
|
let returnedHolds: Hold[];
|
||||||
|
const mockId = 'mockId';
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({});
|
TestBed.configureTestingModule({
|
||||||
|
imports: [ContentTestingModule]
|
||||||
|
});
|
||||||
service = TestBed.inject(LegalHoldService);
|
service = TestBed.inject(LegalHoldService);
|
||||||
|
legalHolds = {
|
||||||
|
list: {
|
||||||
|
entries: [
|
||||||
|
{
|
||||||
|
entry: {
|
||||||
|
id: mockId,
|
||||||
|
name: 'some name',
|
||||||
|
reason: 'some description'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
} as NodeChildAssociationPaging;
|
||||||
|
returnedHolds = [
|
||||||
|
{
|
||||||
|
id: mockId,
|
||||||
|
name: 'some name',
|
||||||
|
reason: 'some description',
|
||||||
|
description: undefined
|
||||||
|
}
|
||||||
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should be created', () => {
|
it('should be created', () => {
|
||||||
expect(service).toBeTruthy();
|
expect(service).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('getHolds', () => {
|
||||||
|
it('should return array of Hold interface', (done) => {
|
||||||
|
spyOn(service.legalHoldApi, 'getHolds').and.returnValue(Promise.resolve(legalHolds));
|
||||||
|
|
||||||
|
service.getHolds(mockId).subscribe((holds) => {
|
||||||
|
expect(holds).toEqual(returnedHolds);
|
||||||
|
expect(service.legalHoldApi.getHolds).toHaveBeenCalledWith(mockId, {});
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -199,4 +199,3 @@ export * from './versionPagingList';
|
|||||||
export * from './deletedNode';
|
export * from './deletedNode';
|
||||||
export * from './nodeAssociation';
|
export * from './nodeAssociation';
|
||||||
export * from './nodeChildAssociation';
|
export * from './nodeChildAssociation';
|
||||||
export * from './nodeHold';
|
|
||||||
|
|||||||
@@ -1,33 +0,0 @@
|
|||||||
/*!
|
|
||||||
* @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 class NodeHold {
|
|
||||||
id: string;
|
|
||||||
/**
|
|
||||||
* The name must not contain spaces or the following special characters: * \" < > \\ / ? : and |.
|
|
||||||
* The character . must not be used at the end of the name.
|
|
||||||
*/
|
|
||||||
name: string;
|
|
||||||
reason: string;
|
|
||||||
description: string;
|
|
||||||
|
|
||||||
constructor(input?: Partial<NodeHold>) {
|
|
||||||
if (input) {
|
|
||||||
Object.assign(this, input);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -21,6 +21,7 @@ Class | Method | HTTP request | Description
|
|||||||
*.GssitesApi* | [**deleteRMSite**](docs/GssitesApi.md#deleteRMSite) | **DELETE** /gs-sites/rm | Delete the Records Management (RM) site
|
*.GssitesApi* | [**deleteRMSite**](docs/GssitesApi.md#deleteRMSite) | **DELETE** /gs-sites/rm | Delete the Records Management (RM) site
|
||||||
*.GssitesApi* | [**getRMSite**](docs/GssitesApi.md#getRMSite) | **GET** /gs-sites/rm | Get the Records Management (RM) site
|
*.GssitesApi* | [**getRMSite**](docs/GssitesApi.md#getRMSite) | **GET** /gs-sites/rm | Get the Records Management (RM) site
|
||||||
*.GssitesApi* | [**updateRMSite**](docs/GssitesApi.md#updateRMSite) | **PUT** /gs-sites/rm | Update the Records Management (RM) site
|
*.GssitesApi* | [**updateRMSite**](docs/GssitesApi.md#updateRMSite) | **PUT** /gs-sites/rm | Update the Records Management (RM) site
|
||||||
|
*.LegalHoldApi* | [**getHolds**](docs/LegalHoldApi.md#getHolds) | **GET** /file-plans/{filePlanId}/holds | Get legal hold list
|
||||||
*.RecordCategoriesApi* | [**createRecordCategoryChild**](docs/RecordCategoriesApi.md#createRecordCategoryChild) | **POST** /record-categories/{recordCategoryId}/children | Create a record category or a record folder
|
*.RecordCategoriesApi* | [**createRecordCategoryChild**](docs/RecordCategoriesApi.md#createRecordCategoryChild) | **POST** /record-categories/{recordCategoryId}/children | Create a record category or a record folder
|
||||||
*.RecordCategoriesApi* | [**deleteRecordCategory**](docs/RecordCategoriesApi.md#deleteRecordCategory) | **DELETE** /record-categories/{recordCategoryId} | Delete a record category
|
*.RecordCategoriesApi* | [**deleteRecordCategory**](docs/RecordCategoriesApi.md#deleteRecordCategory) | **DELETE** /record-categories/{recordCategoryId} | Delete a record category
|
||||||
*.RecordCategoriesApi* | [**getRecordCategory**](docs/RecordCategoriesApi.md#getRecordCategory) | **GET** /record-categories/{recordCategoryId} | Get a record category
|
*.RecordCategoriesApi* | [**getRecordCategory**](docs/RecordCategoriesApi.md#getRecordCategory) | **GET** /record-categories/{recordCategoryId} | Get a record category
|
||||||
@@ -63,6 +64,7 @@ Class | Method | HTTP request | Description
|
|||||||
- [FilePlanComponentBodyUpdate](docs/FilePlanComponentBodyUpdate.md)
|
- [FilePlanComponentBodyUpdate](docs/FilePlanComponentBodyUpdate.md)
|
||||||
- [FilePlanEntry](docs/FilePlanEntry.md)
|
- [FilePlanEntry](docs/FilePlanEntry.md)
|
||||||
- [ModelError](docs/ModelError.md)
|
- [ModelError](docs/ModelError.md)
|
||||||
|
- [NodeChildAssociationPaging](../content-rest-api/docs/NodesApi.md#NodeChildAssociationPaging)
|
||||||
- [Pagination](docs/Pagination.md)
|
- [Pagination](docs/Pagination.md)
|
||||||
- [PathElement](docs/PathElement.md)
|
- [PathElement](docs/PathElement.md)
|
||||||
- [PathInfo](docs/PathInfo.md)
|
- [PathInfo](docs/PathInfo.md)
|
||||||
|
|||||||
@@ -22,15 +22,15 @@ import { ContentPagingQuery, NodeChildAssociationPaging } from '../../content-re
|
|||||||
/**
|
/**
|
||||||
* Legal Holds service.
|
* Legal Holds service.
|
||||||
*
|
*
|
||||||
* @module RecordsApi
|
* @module LegalHoldApi
|
||||||
*/
|
*/
|
||||||
export class LegalHoldApi extends BaseApi {
|
export class LegalHoldApi extends BaseApi {
|
||||||
/**
|
/**
|
||||||
* List of legal holds
|
* List of legal holds
|
||||||
*
|
*
|
||||||
* @param filePlanId The identifier of a file plan. You can also use the -filePlan- alias.
|
* @param filePlanId The identifier of a file plan. You can also use the -filePlan- alias.
|
||||||
* @param opts Optional parameters
|
* @param opt Optional parameters
|
||||||
* @returns Promise<RecordCategoryPaging>
|
* @returns Promise<NodeChildAssociationPaging>
|
||||||
*/
|
*/
|
||||||
getHolds(filePlanId: string = '-filePlan-', opts?: ContentPagingQuery): Promise<NodeChildAssociationPaging> {
|
getHolds(filePlanId: string = '-filePlan-', opts?: ContentPagingQuery): Promise<NodeChildAssociationPaging> {
|
||||||
throwIfNotDefined(filePlanId, 'filePlanId');
|
throwIfNotDefined(filePlanId, 'filePlanId');
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
# Hold
|
||||||
|
|
||||||
|
## Basic usage
|
||||||
|
|
||||||
|
```ts
|
||||||
|
export interface Hold {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
reason?: string;
|
||||||
|
description?: string;
|
||||||
|
selected?: string;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Default value | Description
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**id** | **string** | | hold id
|
||||||
|
**name** | **string** | | hold name
|
||||||
|
**reason** | **string** | | hold reason
|
||||||
|
**description** | **string** | | [optional] [additional information for a hold]
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
# LegalHoldApi
|
||||||
|
|
||||||
|
All URIs are relative to *https://localhost/alfresco/api/-default-/public/gs/versions/1*
|
||||||
|
|
||||||
|
Method | HTTP request | Description
|
||||||
|
------------- | ------------- | -------------
|
||||||
|
[**getHolds**](LegalHoldApi.md#getHolds) | **GET** /file-plans/{filePlanId}/holds | Get legal holds list
|
||||||
|
|
||||||
|
<a name="getHolds"></a>
|
||||||
|
# **getHolds**
|
||||||
|
> NodeChildAssociationPaging getHolds(filePlanId, opts)
|
||||||
|
|
||||||
|
Get legal holds list.
|
||||||
|
|
||||||
|
### 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'
|
||||||
|
});
|
||||||
|
|
||||||
|
let legalHoldApi = new LegalHoldApi(this.alfrescoApi);
|
||||||
|
|
||||||
|
let opts = {
|
||||||
|
'skipCount': 56 // | The number of entities that exist in the collection before those included in this list.
|
||||||
|
'maxItems': 56 // | The maximum number of items to return in the list.
|
||||||
|
};
|
||||||
|
|
||||||
|
legalHoldApi.getHolds('-filePlan-', opts).then((data) => {
|
||||||
|
console.log('API called successfully. Returned data: ' + data);
|
||||||
|
}, function(error) {
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**filePlanId** | **string** | The site details |
|
||||||
|
**skipCount** | **number**| The number of entities that exist in the collection before those included in this list. | [optional]
|
||||||
|
**maxItems** | **number**| The maximum number of items to return in the list. | [optional]
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**NodeChildAssociationPaging**](NodeChildAssociationPaging.md)
|
||||||
+1
@@ -20,4 +20,5 @@ export interface Hold {
|
|||||||
name: string;
|
name: string;
|
||||||
reason?: string;
|
reason?: string;
|
||||||
description?: string;
|
description?: string;
|
||||||
|
selected?: string;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user