mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-4152] Updated folder structure of core docs (#4415)
* [ADF-4152] Moved core library docs into subfolders * [ADF-4152] Moved core library docs into subfolders * [ADF-4152] Manual fixes to core doc file links * [ADF-4152] Further automatic + manual link tidying
This commit is contained in:
committed by
Eugenio Romano
parent
285e56e9fb
commit
5fc05da7aa
127
docs/core/services/activiti-alfresco.service.md
Normal file
127
docs/core/services/activiti-alfresco.service.md
Normal file
@@ -0,0 +1,127 @@
|
||||
---
|
||||
Title: APS Alfresco Content Service
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
---
|
||||
|
||||
# [APS Alfresco Content Service](../../../lib/core/form/services/activiti-alfresco.service.ts "Defined in activiti-alfresco.service.ts")
|
||||
|
||||
Gets Alfresco Repository folder content based on a Repository account configured in Alfresco Process Services (APS).
|
||||
|
||||
It is possible to configure multiple Alfresco Repository accounts in APS (i.e. multiple Alfresco Servers).
|
||||
This service can also be used to link Alfresco content as related content in APS.
|
||||
Content such as documents and other files can be attached to Process Instances
|
||||
and Task Instances as related content.
|
||||
|
||||
**Note:** At the moment you must provide the `ActivitiAlfrescoContentService` class from your `NgModule` for it to work:
|
||||
|
||||
```ts
|
||||
@NgModule({
|
||||
...
|
||||
providers: [ActivitiAlfrescoContentService]
|
||||
})
|
||||
```
|
||||
|
||||
And also import it in the way shown below.
|
||||
|
||||
## Importing
|
||||
|
||||
```ts
|
||||
import { ActivitiAlfrescoContentService } from '@alfresco/adf-core';
|
||||
|
||||
export class SomePageComponent implements OnInit {
|
||||
|
||||
constructor(private contentService: ActivitiAlfrescoContentService) {
|
||||
}
|
||||
```
|
||||
|
||||
## Methods
|
||||
|
||||
#### `getAlfrescoNodes(accountId: string, folderId: string): Observable<ExternalContent>`
|
||||
|
||||
Get all the nodes under passed in folder node ID (e.g. 3062d73b-fe47-4040-89d2-79efae63869c) for passed in
|
||||
Alfresco Repository account ID as configured in APS:
|
||||
|
||||
```ts
|
||||
export class SomePageComponent implements OnInit {
|
||||
|
||||
ngOnInit() {
|
||||
const alfRepoAccountId = 'alfresco-2';
|
||||
const folderNodeId = '3062d73b-fe47-4040-89d2-79efae63869c';
|
||||
this.contentService.getAlfrescoNodes(alfRepoAccountId, folderNodeId).subscribe( nodes => {
|
||||
console.log('Nodes: ', nodes);
|
||||
}, error => {
|
||||
console.log('Error: ', error);
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
In the above sample code the `alfRepoAccountId` points to an Alfresco Repository configuration in APS with ID `alfresco-2`.
|
||||
The `folderNodeId` needs to identify a folder node ID in the Alfresco Repository identified by the `alfRepoAccountId`.
|
||||
|
||||
The response contained in `nodes` is an array with properties for each object like in this sample:
|
||||
|
||||
0:
|
||||
folder: false
|
||||
id: "2223d3c2-0709-4dd7-a79b-c45571901889;1.0"
|
||||
simpleType: "pdf"
|
||||
title: "JLAN_Server_Installation_Guide.pdf"
|
||||
1:
|
||||
folder: false
|
||||
id: "900b4dc0-bfdc-4ec1-84dd-5f1f0a420066;1.0"
|
||||
simpleType: "image"
|
||||
title: "Screen Shot 2017-09-21 at 15.44.23.png"
|
||||
|
||||
2:
|
||||
folder: true
|
||||
id: "f7010382-7b4e-4a78-bb94-9de092439230"
|
||||
simpleType: "folder"
|
||||
title: "Event More Stuff"
|
||||
|
||||
#### `linkAlfrescoNode(accountId: string, node: ExternalContent, siteId: string): Observable<ExternalContentLink>`
|
||||
|
||||
Link Alfresco content as related content in APS by passing in Alfresco node identifying the content, the Share site
|
||||
that contains the content, and the Alfresco Repository account ID as configured in APS:
|
||||
|
||||
```ts
|
||||
export class SomePageComponent implements OnInit {
|
||||
|
||||
ngOnInit() {
|
||||
const alfRepoAccountId = 'alfresco-2';
|
||||
const siteId = 'sample-workspace';
|
||||
const externalContentNode = {
|
||||
id: 'da196918-1324-4e97-9d26-d28f1837a0b6',
|
||||
simpleType: 'content',
|
||||
title: 'simple.txt',
|
||||
folder: false
|
||||
}
|
||||
this.contentService.linkAlfrescoNode(alfRepoAccountId, externalContentNode, siteId).subscribe(link => {
|
||||
console.log('Link: ', link);
|
||||
}, error => {
|
||||
console.log('Error: ', error);
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
In the above sample code the `alfRepoAccountId` points to an Alfresco Repository configuration in APS with ID `alfresco-2`.
|
||||
The `siteId` identifies an Alfresco Share site in the Alfresco Repository where the content to be linked resides.
|
||||
You can get the ID for a Share site from the URL: `http://localhost:8080/share/page/site/<siteId>`.
|
||||
The `externalContentNode` identifies the content that should be set up as temporary related content in APS. The
|
||||
`externalContentNode.id` points to an Alfresco node in the Share site specified with `siteId`.
|
||||
|
||||
The response contained in `link` looks like in this sample:
|
||||
|
||||
link:
|
||||
contentAvailable: true
|
||||
created: Tue Nov 07 2017 13:18:48 GMT+0000 (GMT) {}
|
||||
createdBy: {id: 1, firstName: null, lastName: "Administrator", email: "admin@app.activiti.com"}
|
||||
id: 6006
|
||||
link:true
|
||||
mimeType: null
|
||||
name: "simple.txt"
|
||||
previewStatus: "queued"
|
||||
relatedContent: false
|
||||
simpleType: "content"
|
||||
source: "alfresco-2"
|
||||
sourceId: "da196918-1324-4e97-9d26-d28f1837a0b6@sample-workspace"
|
||||
thumbnailStatus: "queued"
|
63
docs/core/services/alfresco-api.service.md
Normal file
63
docs/core/services/alfresco-api.service.md
Normal file
@@ -0,0 +1,63 @@
|
||||
---
|
||||
Title: Alfresco Api Service
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2019-01-17
|
||||
---
|
||||
|
||||
# [Alfresco Api Service](../../../lib/core/services/alfresco-api.service.ts "Defined in alfresco-api.service.ts")
|
||||
|
||||
Provides access to an initialized **AlfrescoJSApi** instance.
|
||||
|
||||
## Basic Usage
|
||||
|
||||
```ts
|
||||
export class MyComponent implements OnInit {
|
||||
|
||||
constructor(private apiService: AlfrescoApiService) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
let nodeId = 'some-node-id';
|
||||
let params = {};
|
||||
this.apiService.getInstance().nodes
|
||||
.getNodeChildren(nodeId, params)
|
||||
.then(result => console.log(result));
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Properties
|
||||
|
||||
| Name | Type | Default value | Description |
|
||||
| ---- | ---- | ------------- | ----------- |
|
||||
| contentApi | [`ContentApi`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/api/content.api.ts) | | (Read only) Accesses the Content API |
|
||||
| nodesApi | [`NodesApi`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/api/nodes.api.ts) | | (Read only) Accesses the Nodes API |
|
||||
| renditionsApi | [`RenditionsApi`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/api/renditions.api.ts) | | (Read only) Accesses the Renditions API |
|
||||
| sharedLinksApi | [`SharedLinksApi`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/api/sharedlinks.api.ts) | | (Read only) Accesses the Shared Links API |
|
||||
| sitesApi | [`SitesApi`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/api/sites.api.ts) | | (Read only) Accesses the Sites API |
|
||||
| favoritesApi | [`FavoritesApi`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/api/favorites.api.ts) | | (Read only) Accesses the Favorites API |
|
||||
| peopleApi | [`PeopleApi`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/api/people.api.ts) | | (Read only) Accesses the People API |
|
||||
| searchApi | [`SearchApi`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api-legacy/legacy.ts) | | (Read only) Accesses the Search API |
|
||||
| versionsApi | [`VersionsApi`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/api/versions.api.ts) | | (Read only) Accesses the Versions API |
|
||||
| classesApi | [`ClassesApi`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/api/classes.api.ts) | | (Read only) Accesses the Classes API |
|
||||
| groupsApi | [`GroupsApi`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/api/groups.api.ts) | | (Read only) Accesses the Groups API |
|
||||
|
||||
### Events
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ---- | ----------- |
|
||||
| nodeUpdated | [`Subject`](http://reactivex.io/documentation/subject.html)`<`[`Node`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md)`>` | Emitted when a node updates. |
|
||||
|
||||
## Details
|
||||
|
||||
**Note for developers**: The TypeScript declaration files for the Alfresco JS API
|
||||
are still under development and some Alfresco APIs may not be accessible
|
||||
via your IDE's intellisense or TypeScript compiler.
|
||||
To avoid these TypeScript type check errors, you can call any supported
|
||||
Alfresco JS api by casting the instance to the `any` type as in the following example:
|
||||
|
||||
```ts
|
||||
let api: any = this.apiService.getInstance();
|
||||
api.nodes.addNode('-root-', body, {});
|
||||
```
|
155
docs/core/services/app-config.service.md
Normal file
155
docs/core/services/app-config.service.md
Normal file
@@ -0,0 +1,155 @@
|
||||
---
|
||||
Title: App Config service
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2018-09-13
|
||||
---
|
||||
|
||||
# [App Config service](../../../lib/core/app-config/app-config.service.ts "Defined in app-config.service.ts")
|
||||
|
||||
Supports app configuration settings, stored server side.
|
||||
|
||||
## Class members
|
||||
|
||||
### Methods
|
||||
|
||||
- **get**(key: `string`, defaultValue?: )<br/>
|
||||
Gets the value of a named property.
|
||||
- _key:_ `string` - Name of the property
|
||||
- _defaultValue:_ - (Optional) Value to return if the key is not found
|
||||
- **getLocationHostname**(): `string`<br/>
|
||||
Gets the location.hostname property.
|
||||
- **Returns** `string` - Value of the property
|
||||
- **getLocationPort**(prefix: `string` = `""`): `string`<br/>
|
||||
Gets the location.port property.
|
||||
- _prefix:_ `string` - Text added before port value
|
||||
- **Returns** `string` - Port with prefix
|
||||
- **getLocationProtocol**(): `string`<br/>
|
||||
Gets the location.protocol value.
|
||||
- **Returns** `string` - The location.protocol string
|
||||
- **load**(): [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises)`<any>`<br/>
|
||||
Loads the config file.
|
||||
- **Returns** [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises)`<any>` - Notification when loading is complete
|
||||
- **select**(property: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
|
||||
Requests notification of a property value when it is loaded.
|
||||
- _property:_ `string` - The desired property value
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - Property value, when loaded
|
||||
|
||||
## Details
|
||||
|
||||
The [`AppConfigService`](../../core/services/app-config.service.md) service provides support for loading and accessing global application configuration settings that you store on the server side in the form of a JSON file.
|
||||
|
||||
You may need this service when deploying your ADF-based application to production servers.
|
||||
There can be more than one server running web apps with different settings, like different addresses for Alfresco Content/Process services.
|
||||
|
||||
You may also use the service if there is a need to change global settings for all the clients.
|
||||
|
||||
The service is already pre-configured to look for the "app.config.json" file in the application
|
||||
root address. This allows you to deploy ADF-based web applications to multiple servers together with
|
||||
different settings files. You could use this, for example, to create separate development, staging,
|
||||
and production environments.
|
||||
|
||||
Example of the default settings file content:
|
||||
|
||||
**app.config.json**
|
||||
|
||||
```json
|
||||
{
|
||||
"ecmHost": "http://localhost:3000/ecm",
|
||||
"bpmHost": "http://localhost:3000/bpm",
|
||||
"application": {
|
||||
"name": "Alfresco"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Note that the settings in the example above are the default ones supplied with the server.
|
||||
You can override the values in your custom `app.config.json` file if necessary.
|
||||
|
||||
Below is a simple example of using the [`AppConfigService`](../../core/services/app-config.service.md) in practice.
|
||||
|
||||
**app.component.ts**
|
||||
|
||||
```ts
|
||||
import { AppConfigService } from '@alfresco/adf-core';
|
||||
|
||||
@Component({...})
|
||||
export class AppComponent {
|
||||
|
||||
constructor(appConfig: AppConfigService) {
|
||||
|
||||
// get nested properties by the path
|
||||
console.log(appConfig.get('application.name'));
|
||||
|
||||
// use generics for type safety
|
||||
let version: number = appConfig.get<number>('version');
|
||||
console.log(version);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Your custom components can also benefit from the [`AppConfigService`](../../core/services/app-config.service.md).
|
||||
You can create an unlimited number of settings and optionally organize them as a nested JSON hierarchy.
|
||||
|
||||
### Variable substitution in configuration strings
|
||||
|
||||
The [`AppConfigService`](../../core/services/app-config.service.md) supports a limited set of variable substitutions to greatly simplify certain scenarios.
|
||||
|
||||
```json
|
||||
{
|
||||
"ecmHost": "{protocol}//{hostname}:{port}/ecm",
|
||||
"bpmHost": "{protocol}//{hostname}:{port}/bpm",
|
||||
"application": {
|
||||
"name": "Alfresco"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The supported variables are:
|
||||
|
||||
| Variable name | Runtime value |
|
||||
| ------------- | ------------- |
|
||||
| protocol | `location.protocol` |
|
||||
| hostname | `location.hostname` |
|
||||
| port | `location.port` |
|
||||
|
||||
## App Config onLoad Stream
|
||||
|
||||
When the app config is loaded correctly, an `onChange` event is emitted with the whole set of app
|
||||
config properties. This comes in handy when a component needs to react to some property change or
|
||||
interact with the app config when it is finished loading:
|
||||
|
||||
```ts
|
||||
appConfig.onLoad.subscribe((appConfig) => {
|
||||
console.log(appConfig); //this is the representation of the app-config
|
||||
});
|
||||
```
|
||||
|
||||
The `select` method lets you specify the name of a variable that should be set with the value
|
||||
of a property when the app config is loaded:
|
||||
|
||||
```json
|
||||
appconfig : {
|
||||
logLevel : 'trace'
|
||||
}
|
||||
```
|
||||
|
||||
```ts
|
||||
|
||||
appConfig.select('logLevel').subscribe((logLevelValue) => {
|
||||
console.log(logLevelValue); //this will be 'trace';
|
||||
});
|
||||
```
|
||||
|
||||
## XMLHttpRequest.withCredentials
|
||||
|
||||
In the configuration file, you can enable [XMLHttpRequest.withCredentials](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials)
|
||||
for @alfresco/js-api calls and PDF Viewer.
|
||||
|
||||
```json
|
||||
{
|
||||
"auth": {
|
||||
"withCredentials": true
|
||||
}
|
||||
}
|
||||
```
|
36
docs/core/services/apps-process.service.md
Normal file
36
docs/core/services/apps-process.service.md
Normal file
@@ -0,0 +1,36 @@
|
||||
---
|
||||
Title: Apps Process service
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2018-11-16
|
||||
---
|
||||
|
||||
# [Apps Process service](../../../lib/core/services/apps-process.service.ts "Defined in apps-process.service.ts")
|
||||
|
||||
Gets details of the Process Services apps that are deployed for the user.
|
||||
|
||||
## Class members
|
||||
|
||||
### Methods
|
||||
|
||||
- **getApplicationDetailsById**(appId: `number`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`AppDefinitionRepresentation`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-activiti-rest-api/docs/AppDefinitionRepresentation.md)`>`<br/>
|
||||
Gets the details for a specific app ID number.
|
||||
- _appId:_ `number` - ID of the target app
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`AppDefinitionRepresentation`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-activiti-rest-api/docs/AppDefinitionRepresentation.md)`>` - Details of the app
|
||||
- **getDeployedApplications**(): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`AppDefinitionRepresentation`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-activiti-rest-api/docs/AppDefinitionRepresentation.md)`[]>`<br/>
|
||||
Gets a list of deployed apps for this user.
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`AppDefinitionRepresentation`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-activiti-rest-api/docs/AppDefinitionRepresentation.md)`[]>` - The list of deployed apps
|
||||
- **getDeployedApplicationsByName**(name: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`AppDefinitionRepresentation`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-activiti-rest-api/docs/AppDefinitionRepresentation.md)`>`<br/>
|
||||
Gets a list of deployed apps for this user, where the app name is `name`.
|
||||
- _name:_ `string` - Name of the app
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`AppDefinitionRepresentation`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-activiti-rest-api/docs/AppDefinitionRepresentation.md)`>` - The list of deployed apps
|
||||
|
||||
## Details
|
||||
|
||||
This service can be used to access the Process Services apps that are available
|
||||
to the current user. You can find more information about the
|
||||
returned [`AppDefinitionRepresentation`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-activiti-rest-api/docs/AppDefinitionRepresentation.md) class in the
|
||||
[Process Services Apps API](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-activiti-rest-api/docs/AppsApi.md#getAppDefinitions).
|
||||
The methods of this service make use of the
|
||||
[getAppDefinitions](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-activiti-rest-api/docs/AppsApi.md#getAppDefinitions)
|
||||
method, also from the Apps API.
|
44
docs/core/services/auth-guard-bpm.service.md
Normal file
44
docs/core/services/auth-guard-bpm.service.md
Normal file
@@ -0,0 +1,44 @@
|
||||
---
|
||||
Title: Auth Guard Bpm service
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2018-11-13
|
||||
---
|
||||
|
||||
# [Auth Guard Bpm service](../../../lib/core/services/auth-guard-bpm.service.ts "Defined in auth-guard-bpm.service.ts")
|
||||
|
||||
Adds authentication with Process Services to a route within the app.
|
||||
|
||||
## Details
|
||||
|
||||
The Auth Guard Bpm service implements an Angular
|
||||
[route guard](https://angular.io/guide/router#milestone-5-route-guards)
|
||||
to check the user is logged into Process Services. This is typically used with the
|
||||
`canActivate` guard check in the route definition:
|
||||
|
||||
```ts
|
||||
const appRoutes: Routes = [
|
||||
...
|
||||
{
|
||||
path: 'examplepath',
|
||||
component: ExampleComponent,
|
||||
canActivate: [ AuthGuardBpm ] // <- Requires authentication for this route.
|
||||
},
|
||||
...
|
||||
]
|
||||
```
|
||||
|
||||
If the user now clicks on a link or button that follows this route, they will be prompted
|
||||
to log in before proceeding.
|
||||
|
||||
This service only accepts authentication with APS but you can use the
|
||||
[Auth Guard Ecm service](auth-guard-ecm.service.md) to authenticate
|
||||
against ACS or the [Auth Guard service](auth-guard.service.md) to authenticate against
|
||||
either ACS or APS. See the
|
||||
[ADF custom page tutorial](https://community.alfresco.com/docs/DOC-6628-adf-105-creating-custom-pages-and-components)
|
||||
for worked examples of all three guards.
|
||||
|
||||
## See also
|
||||
|
||||
- [Auth guard ecm service](auth-guard-ecm.service.md)
|
||||
- [Auth guard service](auth-guard.service.md)
|
44
docs/core/services/auth-guard-ecm.service.md
Normal file
44
docs/core/services/auth-guard-ecm.service.md
Normal file
@@ -0,0 +1,44 @@
|
||||
---
|
||||
Title: Auth Guard Ecm service
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2018-11-13
|
||||
---
|
||||
|
||||
# [Auth Guard Ecm service](../../../lib/core/services/auth-guard-ecm.service.ts "Defined in auth-guard-ecm.service.ts")
|
||||
|
||||
Adds authentication with Content Services to a route within the app.
|
||||
|
||||
## Details
|
||||
|
||||
The Auth Guard Bpm service implements an Angular
|
||||
[route guard](https://angular.io/guide/router#milestone-5-route-guards)
|
||||
to check the user is logged into Process Services. This is typically used with the
|
||||
`canActivate` guard check in the route definition:
|
||||
|
||||
```ts
|
||||
const appRoutes: Routes = [
|
||||
...
|
||||
{
|
||||
path: 'examplepath',
|
||||
component: ExampleComponent,
|
||||
canActivate: [ AuthGuardBpm ] // <- Requires authentication for this route.
|
||||
},
|
||||
...
|
||||
]
|
||||
```
|
||||
|
||||
If the user now clicks on a link or button that follows this route, they will be prompted
|
||||
to log in before proceeding.
|
||||
|
||||
This service only accepts authentication with ACS but you can use the
|
||||
[Auth Guard Bpm service](auth-guard-bpm.service.md) to authenticate
|
||||
against APS or the [Auth Guard service](auth-guard.service.md) to authenticate against
|
||||
either APS or ACS. See the
|
||||
[ADF custom page tutorial](https://community.alfresco.com/docs/DOC-6628-adf-105-creating-custom-pages-and-components)
|
||||
for worked examples of all three guards.
|
||||
|
||||
## See also
|
||||
|
||||
- [Auth guard service](auth-guard.service.md)
|
||||
- [Auth guard bpm service](auth-guard-bpm.service.md)
|
56
docs/core/services/auth-guard-sso-role.service.md
Normal file
56
docs/core/services/auth-guard-sso-role.service.md
Normal file
@@ -0,0 +1,56 @@
|
||||
---
|
||||
Title: Auth Guard SSO Role service
|
||||
Added: v3.1.0
|
||||
Status: Active
|
||||
---
|
||||
|
||||
# [Auth Guard SSO role service](../../../lib/core/services/auth-guard-sso-role.service.ts "Defined in auth-guard-sso-role.service.ts")
|
||||
|
||||
Allow to check the user roles of a user
|
||||
|
||||
## Details
|
||||
|
||||
The [Auth Guard SSO role service](../../core/services/auth-guard-sso-role.service.md) implements an Angular
|
||||
[route guard](https://angular.io/guide/router#milestone-5-route-guards)
|
||||
to check the user has the right role permission. This is typically used with the
|
||||
`canActivate` guard check in the route definition. The roles that user needs to have in order to access the route has to be specified in the roles array as in the example below:
|
||||
|
||||
```ts
|
||||
const appRoutes: Routes = [
|
||||
...
|
||||
{
|
||||
path: 'examplepath',
|
||||
component: ExampleComponent,
|
||||
canActivate: [ AuthGuardSsoRoleService ],
|
||||
data: { roles: ['USER_ROLE1', 'USER_ROLE2']}
|
||||
},
|
||||
...
|
||||
]
|
||||
```
|
||||
|
||||
If the user now clicks on a link or button that follows this route, they will be not able to access to this content if the user does not have the roles.
|
||||
|
||||
## Redirect over forbidden
|
||||
|
||||
If the you want to redirect the user to a different page over a forbidden error you can use the **redirectUrl** as the example below:
|
||||
|
||||
```ts
|
||||
const appRoutes: Routes = [
|
||||
...
|
||||
{
|
||||
path: 'examplepath',
|
||||
component: ExampleComponent,
|
||||
canActivate: [ AuthGuardSsoRoleService ],
|
||||
data: { roles: ['ACTIVITI_USER'], redirectUrl: '/error/403'}
|
||||
},
|
||||
...
|
||||
]
|
||||
```
|
||||
|
||||
Note: you can use this Guard in and with the other ADF auth guard.
|
||||
|
||||
## See also
|
||||
|
||||
- [Auth guard ecm service](auth-guard-ecm.service.md)
|
||||
- [Auth guard bpm service](auth-guard-bpm.service.md)
|
||||
- [Auth guard service](auth-guard.service.md)
|
45
docs/core/services/auth-guard.service.md
Normal file
45
docs/core/services/auth-guard.service.md
Normal file
@@ -0,0 +1,45 @@
|
||||
---
|
||||
Title: Auth Guard service
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2018-11-13
|
||||
---
|
||||
|
||||
# [Auth Guard service](../../../lib/core/services/auth-guard.service.ts "Defined in auth-guard.service.ts")
|
||||
|
||||
Adds authentication to a route within the app.
|
||||
|
||||
## Details
|
||||
|
||||
The Auth Guard service implements an Angular
|
||||
[route guard](https://angular.io/guide/router#milestone-5-route-guards)
|
||||
to check the user is logged in. This is typically used with the
|
||||
`canActivate` guard check in the route definition:
|
||||
|
||||
```ts
|
||||
const appRoutes: Routes = [
|
||||
...
|
||||
{
|
||||
path: 'examplepath',
|
||||
component: ExampleComponent,
|
||||
canActivate: [ AuthGuard ] // <- Requires authentication for this route.
|
||||
},
|
||||
...
|
||||
]
|
||||
```
|
||||
|
||||
If the user now clicks on a link or button that follows this route, they will be prompted
|
||||
to log in before proceeding.
|
||||
|
||||
This service will accept authentication with either APS or ACS as valid and is thus suitable for
|
||||
menu pages and other content that doesn't make use of APS or ACS features. Use the
|
||||
[Auth Guard Bpm service](auth-guard-bpm.service.md) and
|
||||
[Auth Guard Ecm service](auth-guard-ecm.service.md) to authenticate
|
||||
against APS or ACS, respectively. See the
|
||||
[ADF custom page tutorial](https://community.alfresco.com/docs/DOC-6628-adf-105-creating-custom-pages-and-components)
|
||||
for worked examples of all three guards.
|
||||
|
||||
## See also
|
||||
|
||||
- [Auth guard bpm service](auth-guard-bpm.service.md)
|
||||
- [Auth guard ecm service](auth-guard-ecm.service.md)
|
117
docs/core/services/authentication.service.md
Normal file
117
docs/core/services/authentication.service.md
Normal file
@@ -0,0 +1,117 @@
|
||||
---
|
||||
Title: Authentication Service
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2018-11-19
|
||||
---
|
||||
|
||||
# [Authentication Service](../../../lib/core/services/authentication.service.ts "Defined in authentication.service.ts")
|
||||
|
||||
Provides authentication to ACS and APS.
|
||||
|
||||
## Class members
|
||||
|
||||
### Methods
|
||||
|
||||
- **addTokenToHeader**(headersArg?: `HttpHeaders`): [`Observable`](http://reactivex.io/documentation/observable.html)`<HttpHeaders>`<br/>
|
||||
Adds the auth token to an HTTP header using the 'bearer' scheme.
|
||||
- _headersArg:_ `HttpHeaders` - (Optional) Header that will receive the token
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<HttpHeaders>` - The new header with the token added
|
||||
- **getBearerExcludedUrls**(): `string[]`<br/>
|
||||
Gets the set of URLs that the token bearer is excluded from.
|
||||
- **Returns** `string[]` - Array of URL strings
|
||||
- **getBpmLoggedUser**(): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`UserRepresentation`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/activiti-rest-api/docs/UserRepresentation.md)`>`<br/>
|
||||
Gets information about the user currently logged into APS.
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`UserRepresentation`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/activiti-rest-api/docs/UserRepresentation.md)`>` - User information
|
||||
- **getBpmUsername**(): `string`<br/>
|
||||
Gets the BPM username
|
||||
- **Returns** `string` - The BPM username
|
||||
- **getEcmUsername**(): `string`<br/>
|
||||
Gets the ECM username.
|
||||
- **Returns** `string` - The ECM username
|
||||
- **getRedirect**(): `string`<br/>
|
||||
Gets the URL to redirect to after login.
|
||||
- **Returns** `string` - The redirect URL
|
||||
- **getTicketBpm**(): `string|null`<br/>
|
||||
Gets the BPM ticket stored in the Storage.
|
||||
- **Returns** `string|null` - The ticket or `null` if none was found
|
||||
- **getTicketEcm**(): `string|null`<br/>
|
||||
Gets the ECM ticket stored in the Storage.
|
||||
- **Returns** `string|null` - The ticket or `null` if none was found
|
||||
- **getTicketEcmBase64**(): `string|null`<br/>
|
||||
Gets the BPM ticket from the Storage in Base 64 format.
|
||||
- **Returns** `string|null` - The ticket or `null` if none was found
|
||||
- **getToken**(): `string`<br/>
|
||||
Gets the auth token.
|
||||
- **Returns** `string` - Auth token string
|
||||
- **handleError**(error: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
|
||||
Prints an error message in the console browser
|
||||
- _error:_ `any` - Error message
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - Object representing the error message
|
||||
- **isALLProvider**(): `boolean`<br/>
|
||||
Does the provider support both ECM and BPM?
|
||||
- **Returns** `boolean` - True if both are supported, false otherwise
|
||||
- **isBPMProvider**(): `boolean`<br/>
|
||||
Does the provider support BPM?
|
||||
- **Returns** `boolean` - True if supported, false otherwise
|
||||
- **isBpmLoggedIn**(): `boolean`<br/>
|
||||
Checks if the user is logged in on a BPM provider.
|
||||
- **Returns** `boolean` - True if logged in, false otherwise
|
||||
- **isECMProvider**(): `boolean`<br/>
|
||||
Does the provider support ECM?
|
||||
- **Returns** `boolean` - True if supported, false otherwise
|
||||
- **isEcmLoggedIn**(): `boolean`<br/>
|
||||
Checks if the user is logged in on an ECM provider.
|
||||
- **Returns** `boolean` - True if logged in, false otherwise
|
||||
- **isLoggedIn**(): `boolean`<br/>
|
||||
Checks if the user logged in.
|
||||
- **Returns** `boolean` - True if logged in, false otherwise
|
||||
- **isOauth**(): `boolean`<br/>
|
||||
Does the provider support OAuth?
|
||||
- **Returns** `boolean` - True if supported, false otherwise
|
||||
- **isRememberMeSet**(): `boolean`<br/>
|
||||
Checks whether the "remember me" cookie was set or not.
|
||||
- **Returns** `boolean` - True if set, false otherwise
|
||||
- **isSSODiscoveryConfigured**(): `boolean`<br/>
|
||||
Check if SSO is configured correctly
|
||||
- **Returns** `boolean` -
|
||||
- **login**(username: `string`, password: `string`, rememberMe: `boolean` = `false`): [`Observable`](http://reactivex.io/documentation/observable.html)`<Function>`<br/>
|
||||
Logs the user in.
|
||||
- _username:_ `string` - Username for the login
|
||||
- _password:_ `string` - Password for the login
|
||||
- _rememberMe:_ `boolean` - Stores the user's login details if true
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<Function>` - Object with auth type ("ECM", "BPM" or "ALL") and auth ticket
|
||||
- **logout**(): `any`<br/>
|
||||
Logs the user out.
|
||||
- **Returns** `any` - Response event called when logout is complete
|
||||
- **setRedirect**(url: [`RedirectionModel`](../../../lib/core/models/redirection.model.ts))<br/>
|
||||
Sets the URL to redirect to after login.
|
||||
- _url:_ [`RedirectionModel`](../../../lib/core/models/redirection.model.ts) - URL to redirect to
|
||||
- **ssoImplicitLogin**()<br/>
|
||||
Logs the user in with SSO
|
||||
|
||||
## Details
|
||||
|
||||
### Usage example
|
||||
|
||||
```ts
|
||||
import { AuthenticationService } from '@alfresco/adf-core';
|
||||
|
||||
@Component({...})
|
||||
export class AppComponent {
|
||||
constructor(authService: AuthenticationService) {
|
||||
this.AuthenticationService.login('admin', 'admin').subscribe(
|
||||
token => {
|
||||
console.log(token);
|
||||
},
|
||||
error => {
|
||||
console.log(error);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
- [Login component](../components/login.component.md)
|
37
docs/core/services/bpm-user.service.md
Normal file
37
docs/core/services/bpm-user.service.md
Normal file
@@ -0,0 +1,37 @@
|
||||
---
|
||||
Title: Bpm User service
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2018-11-19
|
||||
---
|
||||
|
||||
# [Bpm User service](../../../lib/core/userinfo/services/bpm-user.service.ts "Defined in bpm-user.service.ts")
|
||||
|
||||
Gets information about the current Process Services user.
|
||||
|
||||
## Class members
|
||||
|
||||
### Methods
|
||||
|
||||
- **getCurrentUserInfo**(): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`BpmUserModel`](../../core/models/bpm-user.model.md)`>`<br/>
|
||||
Gets information about the current user.
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`BpmUserModel`](../../core/models/bpm-user.model.md)`>` - User information object
|
||||
- **getCurrentUserProfileImage**(): `string`<br/>
|
||||
Gets the current user's profile image as a URL.
|
||||
- **Returns** `string` - URL string
|
||||
|
||||
## Details
|
||||
|
||||
The class returned by `getCurrentUserInfo` is detailed
|
||||
in the [Bpm User model docs](../models/bpm-user.model.md).
|
||||
|
||||
See the
|
||||
[getProfile](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-activiti-rest-api/docs/ProfileApi.md#getProfile)
|
||||
and
|
||||
[getProfilePictureUrl](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-activiti-rest-api/docs/ProfileApi.md#getProfilePictureUrl)
|
||||
methods in the Alfresco JS API for more information about the REST calls used by this service.
|
||||
|
||||
## See also
|
||||
|
||||
- [Ecm user service](../services/ecm-user.service.md)
|
||||
- [Bpm user model](../models/bpm-user.model.md)
|
75
docs/core/services/card-item-types.service.md
Normal file
75
docs/core/services/card-item-types.service.md
Normal file
@@ -0,0 +1,75 @@
|
||||
---
|
||||
Title: Card Item Type service
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2018-11-20
|
||||
---
|
||||
|
||||
# [Card Item Type service](../../../lib/core/card-view/services/card-item-types.service.ts "Defined in card-item-types.service.ts")
|
||||
|
||||
Maps type names to field component types for the [Card View component](../components/card-view.component.md).
|
||||
|
||||
## Class members
|
||||
|
||||
### Methods
|
||||
|
||||
- **getComponentTypeResolver**(type: `string`, defaultValue: `Type<__type>` = `this.defaultValue`): `DynamicComponentResolveFunction`<br/>
|
||||
Gets the currently active DynamicComponentResolveFunction for a field type.
|
||||
- _type:_ `string` - The type whose resolver you want
|
||||
- _defaultValue:_ `Type<__type>` - Default type returned for types that are not yet mapped
|
||||
- **Returns** `DynamicComponentResolveFunction` - Resolver function
|
||||
- **resolveComponentType**(model: [`DynamicComponentModel`](../../../lib/core/services/dynamic-component-mapper.service.ts), defaultValue: `Type<__type>` = `this.defaultValue`): `Type<__type>`<br/>
|
||||
Finds the component type that is needed to render a form field.
|
||||
- _model:_ [`DynamicComponentModel`](../../../lib/core/services/dynamic-component-mapper.service.ts) - [Form](../../../lib/process-services/task-list/models/form.model.ts) field model for the field to render
|
||||
- _defaultValue:_ `Type<__type>` - Default type returned for field types that are not yet mapped.
|
||||
- **Returns** `Type<__type>` - Component type
|
||||
- **setComponentTypeResolver**(type: `string`, resolver: `DynamicComponentResolveFunction`, override: `boolean` = `true`)<br/>
|
||||
Sets or optionally replaces a DynamicComponentResolveFunction for a field type.
|
||||
- _type:_ `string` - The type whose resolver you want to set
|
||||
- _resolver:_ `DynamicComponentResolveFunction` - The new resolver function
|
||||
- _override:_ `boolean` - The new resolver will only replace an existing one if this parameter is true
|
||||
|
||||
## Details
|
||||
|
||||
The [Card View component](../components/card-view.component.md) uses this service to find the component
|
||||
type that is required to display a particular field type (text, date, etc). The service
|
||||
maps a type name string to a corresponding `DynamicComponentResolveFunction` that takes a
|
||||
model object as a parameter and returns the component type needed to display that model.
|
||||
|
||||
The default mapping is shown below:
|
||||
|
||||
| Type string | Component |
|
||||
| ----------- | --------- |
|
||||
| 'text' | [`CardViewTextItemComponent`](../../../lib/core/card-view/components/card-view-textitem/card-view-textitem.component.ts) |
|
||||
| 'int' | [`CardViewTextItemComponent`](../../../lib/core/card-view/components/card-view-textitem/card-view-textitem.component.ts) |
|
||||
| 'float' | [`CardViewTextItemComponent`](../../../lib/core/card-view/components/card-view-textitem/card-view-textitem.component.ts) |
|
||||
| 'date' | [`CardViewDateItemComponent`](../../../lib/core/card-view/components/card-view-dateitem/card-view-dateitem.component.ts) |
|
||||
| 'datetime' | [`CardViewDateItemComponent`](../../../lib/core/card-view/components/card-view-dateitem/card-view-dateitem.component.ts) |
|
||||
| 'bool' | [`CardViewBoolItemComponent`](../../../lib/core/card-view/components/card-view-boolitem/card-view-boolitem.component.ts) |
|
||||
| 'map' | [`CardViewMapItemComponent`](../../../lib/core/card-view/components/card-view-mapitem/card-view-mapitem.component.ts) |
|
||||
|
||||
### Adding new type mappings
|
||||
|
||||
You can define your own custom field types for the Card View (see the
|
||||
[Card View Item interface](../interfaces/card-view-item.interface.md) page for full details of how to do this).
|
||||
When you have defined the field component, you need to register it with the [Card Item Types service](../../../lib/core/card-view/services/card-item-types.service.ts)
|
||||
so that the [Card View component](../components/card-view.component.md) can make use of it:
|
||||
|
||||
```ts
|
||||
@Component({
|
||||
...
|
||||
providers: [ CardItemTypeService ] /* If you don't want to pollute the main instance of the CardItemTypeService service */
|
||||
...
|
||||
})
|
||||
export class SomeParentComponent {
|
||||
|
||||
constructor(private cardItemTypeService: CardItemTypeService) {
|
||||
cardItemTypeService.setComponentTypeResolver('star-date', () => CardViewStarDateItemComponent);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
- [Card View component](../components/card-view.component.md)
|
||||
- [Card View Item interface](../interfaces/card-view-item.interface.md)
|
131
docs/core/services/card-view-update.service.md
Normal file
131
docs/core/services/card-view-update.service.md
Normal file
@@ -0,0 +1,131 @@
|
||||
---
|
||||
Title: Card View Update service
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2018-11-14
|
||||
---
|
||||
|
||||
# [Card View Update service](../../../lib/core/card-view/services/card-view-update.service.ts "Defined in card-view-update.service.ts")
|
||||
|
||||
Reports edits and clicks within fields of a [Card View component](../components/card-view.component.md).
|
||||
|
||||
## Details
|
||||
|
||||
You can use the [Card View Update service](card-view-update.service.md) to respond to edits and clicks within items on
|
||||
a card view. This might involve updating application data to reflect the changes made to
|
||||
the view or could simply be a matter of highlighting a clicked item.
|
||||
|
||||
The service is injected into a component using a constructor parameter, which also
|
||||
creates a corresponding property in the object:
|
||||
|
||||
```ts
|
||||
properties: any;
|
||||
|
||||
constructor(private cardViewUpdateService: CardViewUpdateService) {
|
||||
|
||||
this.properties = [
|
||||
new CardViewTextItemModel({
|
||||
label: 'Name',
|
||||
value: 'Kirk',
|
||||
key: 'name',
|
||||
default: 'No name entered',
|
||||
multiline: false,
|
||||
editable: true,
|
||||
clickable: true
|
||||
}),
|
||||
new CardViewTextItemModel({
|
||||
label: 'Rank',
|
||||
value: 'Captain',
|
||||
key: 'rank',
|
||||
default: 'No rank entered',
|
||||
multiline: false,
|
||||
editable: true,
|
||||
clickable: true
|
||||
}),
|
||||
new CardViewTextItemModel({
|
||||
label: 'Ship',
|
||||
value: 'Enterprise',
|
||||
key: 'ship',
|
||||
default: 'No ship entered',
|
||||
multiline: false,
|
||||
editable: true,
|
||||
clickable: true
|
||||
})
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
The constructor here also sets the [`CardViewTextItemModel`](../../../lib/core/card-view/models/card-view-textitem.model.ts) instances that define the layout of the
|
||||
card view (see the [Card View component](../components/card-view.component.md) for further information
|
||||
about this). The model objects and the `key` property are used to identify which item has been clicked
|
||||
or updated when an event occurs.
|
||||
|
||||
You must subscribe to the service to be informed about clicks and updates. You can do this by
|
||||
registering your own functions with the service's `itemUpdated$` and `itemClicked$` events
|
||||
(place this code in the `ngOnInit`
|
||||
[lifecycle hook](https://angular.io/guide/lifecycle-hooks#oninit) rather than the constructor):
|
||||
|
||||
```ts
|
||||
ngOnInit() {
|
||||
this.cardViewUpdateService.itemUpdated$.subscribe(this.respondToCardUpdate.bind(this));
|
||||
this.cardViewUpdateService.itemClicked$.subscribe(this.respondToCardClick.bind(this));
|
||||
}
|
||||
```
|
||||
|
||||
With the subscriptions in place, `respondToCardUpdate` and `respondToCardClick` will now be
|
||||
called after updates and clicks, respectively.
|
||||
|
||||
### Responding to updates
|
||||
|
||||
The update function is passed a parameter of type [`UpdateNotification`](../../../lib/core/card-view/services/card-view-update.service.ts):
|
||||
|
||||
```ts
|
||||
export interface UpdateNotification {
|
||||
target: any;
|
||||
changed: any;
|
||||
}
|
||||
```
|
||||
|
||||
Here, `target` contains the [`CardViewTextItemModel`](../../../lib/core/card-view/models/card-view-textitem.model.ts) that was used to initialize
|
||||
the field in question (in practice, this might be a [`CardViewDateItemModel`](../../../lib/core/card-view/models/card-view-dateitem.model.ts) or [`CardViewMapItemModel`](../../../lib/core/card-view/models/card-view-mapitem.model.ts) if
|
||||
the card layout includes these objects). The `changed` property contains an object with a single property:
|
||||
|
||||
```ts
|
||||
{ keyValue: 'Value after editing' }
|
||||
```
|
||||
|
||||
Here, `keyValue` is actually the value of the `key` field specified when the item was initialized. So
|
||||
in our example, if the third item was edited from 'Enterprise' to 'Shuttle Craft', the object would be:
|
||||
|
||||
```ts
|
||||
{ ship: 'Shuttle Craft' }
|
||||
```
|
||||
|
||||
The complete code for `respondToCardUpdate` might look something like the following:
|
||||
|
||||
```ts
|
||||
respondToCardUpdate(un: UpdateNotification) {
|
||||
this.updateMessage = un.target.label + ' changed to ' + un.changed[un.target.key];
|
||||
}
|
||||
```
|
||||
|
||||
Note that the function will only be called if the `editable` property of the model object is set to true
|
||||
for this item. Also, the `editable` value of all items will be overridden if `editable` is set to false
|
||||
on the [Card View component](../components/card-view.component.md) itself.
|
||||
|
||||
### Responding to clicks
|
||||
|
||||
The click function is passed a [`ClickNotification`](../../../lib/core/card-view/services/card-view-update.service.ts) object, which is similar to [`UpdateNotification`](../../../lib/core/card-view/services/card-view-update.service.ts) described above,
|
||||
but without the `changed` property. Use the `target` property to identify the item that was clicked:
|
||||
|
||||
```ts
|
||||
respondToCardClick(cn: ClickNotification) {
|
||||
this.clickMessage = cn.target.label + ' was just clicked';
|
||||
}
|
||||
```
|
||||
|
||||
Note that this function will only be called if the `clickable` property of the model object is set to true for this item.
|
||||
|
||||
## See also
|
||||
|
||||
- [Card view component](../components/card-view.component.md)
|
34
docs/core/services/comment-content.service.md
Normal file
34
docs/core/services/comment-content.service.md
Normal file
@@ -0,0 +1,34 @@
|
||||
---
|
||||
Title: Comment Content service
|
||||
Added: v2.3.0
|
||||
Status: Active
|
||||
Last reviewed: 2018-04-12
|
||||
---
|
||||
|
||||
# [Comment Content service](../../../lib/core/services/comment-content.service.ts "Defined in comment-content.service.ts")
|
||||
|
||||
Adds and retrieves comments for nodes in Content Services.
|
||||
|
||||
## Class members
|
||||
|
||||
### Methods
|
||||
|
||||
- **addNodeComment**(nodeId: `string`, message: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`CommentModel`](../../../lib/core/models/comment.model.ts)`>`<br/>
|
||||
Adds a comment to a node.
|
||||
- _nodeId:_ `string` - ID of the target node
|
||||
- _message:_ `string` - Text for the comment
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`CommentModel`](../../../lib/core/models/comment.model.ts)`>` - Details of the comment added
|
||||
- **getNodeComments**(nodeId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`CommentModel`](../../../lib/core/models/comment.model.ts)`[]>`<br/>
|
||||
Gets all comments that have been added to a node.
|
||||
- _nodeId:_ `string` - ID of the target node
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`CommentModel`](../../../lib/core/models/comment.model.ts)`[]>` - Details for each comment
|
||||
|
||||
## Details
|
||||
|
||||
See the Comments API section of the
|
||||
[Alfresco JS API docs](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/CommentsApi.md#addComment)
|
||||
for more information about the underlying REST API.
|
||||
|
||||
## See also
|
||||
|
||||
- [Comment process service](comment-process.service.md)
|
39
docs/core/services/comment-process.service.md
Normal file
39
docs/core/services/comment-process.service.md
Normal file
@@ -0,0 +1,39 @@
|
||||
---
|
||||
Title: Comment Process service
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2018-11-14
|
||||
---
|
||||
|
||||
# [Comment Process service](../../../lib/core/services/comment-process.service.ts "Defined in comment-process.service.ts")
|
||||
|
||||
Adds and retrieves comments for task and process instances in Process Services.
|
||||
|
||||
## Class members
|
||||
|
||||
### Methods
|
||||
|
||||
- **addProcessInstanceComment**(processInstanceId: `string`, message: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`CommentModel`](../../../lib/core/models/comment.model.ts)`>`<br/>
|
||||
Adds a comment to a process instance.
|
||||
- _processInstanceId:_ `string` - ID of the target process instance
|
||||
- _message:_ `string` - Text for the comment
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`CommentModel`](../../../lib/core/models/comment.model.ts)`>` - Details of the comment added
|
||||
- **addTaskComment**(taskId: `string`, message: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`CommentModel`](../../../lib/core/models/comment.model.ts)`>`<br/>
|
||||
Adds a comment to a task.
|
||||
- _taskId:_ `string` - ID of the target task
|
||||
- _message:_ `string` - Text for the comment
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`CommentModel`](../../../lib/core/models/comment.model.ts)`>` - Details about the comment
|
||||
- **getProcessInstanceComments**(processInstanceId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`CommentModel`](../../../lib/core/models/comment.model.ts)`[]>`<br/>
|
||||
Gets all comments that have been added to a process instance.
|
||||
- _processInstanceId:_ `string` - ID of the target process instance
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`CommentModel`](../../../lib/core/models/comment.model.ts)`[]>` - Details for each comment
|
||||
- **getTaskComments**(taskId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`CommentModel`](../../../lib/core/models/comment.model.ts)`[]>`<br/>
|
||||
Gets all comments that have been added to a task.
|
||||
- _taskId:_ `string` - ID of the target task
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`CommentModel`](../../../lib/core/models/comment.model.ts)`[]>` - Details for each comment
|
||||
|
||||
## Details
|
||||
|
||||
See the Comments API section of the
|
||||
[Alfresco JS API docs](https://github.com/Alfresco/alfresco-js-api/tree/master/src/alfresco-activiti-rest-api)
|
||||
for further details about the underlying REST API.
|
98
docs/core/services/content.service.md
Normal file
98
docs/core/services/content.service.md
Normal file
@@ -0,0 +1,98 @@
|
||||
---
|
||||
Title: Content service
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2019-02-13
|
||||
---
|
||||
|
||||
# [Content service](../../../lib/core/services/content.service.ts "Defined in content.service.ts")
|
||||
|
||||
Accesses app-generated data objects via URLs and file downloads.
|
||||
|
||||
## Class members
|
||||
|
||||
### Methods
|
||||
|
||||
- **createTrustedUrl**(blob: [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob)): `string`<br/>
|
||||
Creates a trusted object URL from the [Blob](https://developer.mozilla.org/en-US/docs/Web/API/Blob). WARNING: calling this method with untrusted user data exposes your application to XSS security risks!
|
||||
- _blob:_ [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) - Data to wrap into object URL
|
||||
- **Returns** `string` - URL string
|
||||
- **downloadBlob**(blob: [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob), fileName: `string`)<br/>
|
||||
Invokes content download for a [Blob](https://developer.mozilla.org/en-US/docs/Web/API/Blob) with a file name.
|
||||
- _blob:_ [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) - Content to download.
|
||||
- _fileName:_ `string` - Name of the resulting file.
|
||||
- **downloadData**(data: `any`, fileName: `string`)<br/>
|
||||
Invokes content download for a data array with a file name.
|
||||
- _data:_ `any` - Data to download.
|
||||
- _fileName:_ `string` - Name of the resulting file.
|
||||
- **downloadJSON**(json: `any`, fileName: `string`)<br/>
|
||||
Invokes content download for a JSON object with a file name.
|
||||
- _json:_ `any` - JSON object to download.
|
||||
- _fileName:_ `string` - Name of the resulting file.
|
||||
- **getContentUrl**(node: `any`, attachment?: `boolean`, ticket?: `string`): `string`<br/>
|
||||
Gets a content URL for the given node.
|
||||
- _node:_ `any` - [Node](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md) to get URL for.
|
||||
- _attachment:_ `boolean` - (Optional) Toggles whether to retrieve content as an attachment for download
|
||||
- _ticket:_ `string` - (Optional) Custom ticket to use for authentication
|
||||
- **Returns** `string` - URL string
|
||||
- **getDocumentThumbnailUrl**(node: `any`, attachment?: `boolean`, ticket?: `string`): `string`<br/>
|
||||
Gets a thumbnail URL for the given document node.
|
||||
- _node:_ `any` - [Node](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md) to get URL for.
|
||||
- _attachment:_ `boolean` - (Optional) Toggles whether to retrieve content as an attachment for download
|
||||
- _ticket:_ `string` - (Optional) Custom ticket to use for authentication
|
||||
- **Returns** `string` - URL string
|
||||
- **getNode**(nodeId: `string`, opts?: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`NodeEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeEntry.md)`>`<br/>
|
||||
Gets a Node via its node ID.
|
||||
- _nodeId:_ `string` - ID of the target node
|
||||
- _opts:_ `any` - (Optional) Options supported by JS-API
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`NodeEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeEntry.md)`>` - Details of the folder
|
||||
- **getNodeContent**(nodeId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
|
||||
Gets content for the given node.
|
||||
- _nodeId:_ `string` - ID of the target node
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - Content data
|
||||
- **hasAllowableOperations**(node: [`Node`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md), allowableOperation: [`AllowableOperationsEnum`](../../../lib/core/models/allowable-operations.enum.ts)`|string`): `boolean`<br/>
|
||||
Checks if the user has permissions on that node
|
||||
- _node:_ [`Node`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md) - [Node](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md) to check allowableOperations
|
||||
- _allowableOperation:_ [`AllowableOperationsEnum`](../../../lib/core/models/allowable-operations.enum.ts)`|string` - Create, delete, update, updatePermissions, !create, !delete, !update, !updatePermissions
|
||||
- **Returns** `boolean` - True if the user has the required permissions, false otherwise
|
||||
- **hasPermissions**(node: [`Node`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md), permission: [`PermissionsEnum`](../../../lib/core/models/permissions.enum.ts)`|string`): `boolean`<br/>
|
||||
Checks if the user has permission on that node
|
||||
- _node:_ [`Node`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md) - [Node](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md) to check permissions
|
||||
- _permission:_ [`PermissionsEnum`](../../../lib/core/models/permissions.enum.ts)`|string` -
|
||||
- **Returns** `boolean` - True if the user has the required permissions, false otherwise
|
||||
|
||||
## Details
|
||||
|
||||
Use the [Content service](content.service.md) to deliver data to the user from [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) objects.
|
||||
|
||||
The [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) class
|
||||
(implemented in the browser, not ADF) represents an array of bytes that you can
|
||||
use to construct and store data in any binary format you choose.
|
||||
The user can access a [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) either by downloading the byte array as a file or in
|
||||
some cases by viewing it directly in the browser via a special URL that references
|
||||
the [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob). For example, you could use the [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) interface to construct an image in the
|
||||
[PNG format](https://en.wikipedia.org/wiki/Portable_Network_Graphics). Since
|
||||
PNG is a format the browser can display, you could use the [Blob's](https://developer.mozilla.org/en-US/docs/Web/API/Blob) URL in an
|
||||
<img> element to view the image within the page. Alternatively, you could let
|
||||
the user download it as a PNG file.
|
||||
|
||||
The `downloadBlob` method starts a download of the [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) data to the `filename`
|
||||
within the user's downloads folder. The other `downloadXXX` methods do the same
|
||||
but first convert the supplied data to a [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) before downloading; see the
|
||||
[Blob reference page](https://developer.mozilla.org/en-US/docs/Web/API/Blob)
|
||||
for details of how a [Blob's](https://developer.mozilla.org/en-US/docs/Web/API/Blob) contents are assembled from the constructor arguments.
|
||||
|
||||
Use `createdTrustedUrl` to generate a URL string for a [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob). The URL refers to
|
||||
the [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) as though it were a file but it is actually an object stored in memory,
|
||||
so it does not persist across browser sessions. This URL can be used much like any
|
||||
other, so you could use it for the `src` attribute of an <img> element or the
|
||||
`href` of a download link. Note that while the URL is 'trusted', the data it contains
|
||||
is not necessarily trustworthy unless you can vouch for it yourself; be careful that
|
||||
the data doesn't expose your app to
|
||||
[Cross Site Scripting](https://en.wikipedia.org/wiki/Cross-site_scripting)
|
||||
attacks.
|
||||
|
||||
## See also
|
||||
|
||||
- [Cookie service](cookie.service.md)
|
||||
- [Storage service](storage.service.md)
|
46
docs/core/services/cookie.service.md
Normal file
46
docs/core/services/cookie.service.md
Normal file
@@ -0,0 +1,46 @@
|
||||
---
|
||||
Title: Cookie service
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2018-11-13
|
||||
---
|
||||
|
||||
# [Cookie service](../../../lib/core/services/cookie.service.ts "Defined in cookie.service.ts")
|
||||
|
||||
Stores key-value data items as browser cookies.
|
||||
|
||||
## Class members
|
||||
|
||||
### Methods
|
||||
|
||||
- **clear**()<br/>
|
||||
Placeholder for testing purposes - do not use.
|
||||
- **getItem**(key: `string`): `string|null`<br/>
|
||||
Retrieves a cookie by its key.
|
||||
- _key:_ `string` - Key to identify the cookie
|
||||
- **Returns** `string|null` - The cookie data or null if it is not found
|
||||
- **isEnabled**(): `boolean`<br/>
|
||||
Checks if cookies are enabled.
|
||||
- **Returns** `boolean` - True if enabled, false otherwise
|
||||
- **setItem**(key: `string`, data: `string`, expiration: `Date|null`, path: `string|null`)<br/>
|
||||
Sets a cookie.
|
||||
- _key:_ `string` - Key to identify the cookie
|
||||
- _data:_ `string` - Data value to set for the cookie
|
||||
- _expiration:_ `Date|null` - Expiration date of the data
|
||||
- _path:_ `string|null` - "Pathname" to store the cookie
|
||||
|
||||
## Details
|
||||
|
||||
This service uses browser [cookies](https://en.wikipedia.org/wiki/HTTP_cookie)
|
||||
to store data in the form of key-value pairs. An optional `expiration` date can be
|
||||
supplied for the cookie and a `path` can be used to reduce the chances of name
|
||||
clashes with cookies from other sources.
|
||||
|
||||
Cookies have a storage size limit that varies between browsers but is often around
|
||||
4KB. Consider using [web storage](storage.service.md) if you need to store data
|
||||
beyond this size.
|
||||
|
||||
## See also
|
||||
|
||||
- [Content service](content.service.md)
|
||||
- [Storage service](storage.service.md)
|
31
docs/core/services/deleted-nodes-api.service.md
Normal file
31
docs/core/services/deleted-nodes-api.service.md
Normal file
@@ -0,0 +1,31 @@
|
||||
---
|
||||
Title: Deleted Nodes Api service
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2018-04-05
|
||||
---
|
||||
|
||||
# [Deleted Nodes Api service](../../../lib/core/services/deleted-nodes-api.service.ts "Defined in deleted-nodes-api.service.ts")
|
||||
|
||||
Gets a list of Content Services nodes currently in the trash.
|
||||
|
||||
## Class members
|
||||
|
||||
### Methods
|
||||
|
||||
- **getDeletedNodes**(options?: `Object`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`NodePaging`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/NodePaging.md)`>`<br/>
|
||||
Gets a list of nodes in the trash.
|
||||
- _options:_ `Object` - (Optional) Options for JS-API call
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`NodePaging`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/NodePaging.md)`>` - List of nodes in the trash
|
||||
|
||||
## Details
|
||||
|
||||
The `getDeletedNodes` method returns a [`NodePaging`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/NodePaging.md) object that lists
|
||||
the items in the trash. The format of the `options` parameter is
|
||||
described in the [getDeletedNodes](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodesApi.md#getDeletedNodes)
|
||||
page of the Alfresco JS API docs.
|
||||
|
||||
## See also
|
||||
|
||||
- [Nodes api service](nodes-api.service.md)
|
||||
- [Node service](node.service.md)
|
33
docs/core/services/discovery-api.service.md
Normal file
33
docs/core/services/discovery-api.service.md
Normal file
@@ -0,0 +1,33 @@
|
||||
---
|
||||
Title: Discovery Api service
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2018-11-19
|
||||
---
|
||||
|
||||
# [Discovery Api service](../../../lib/core/services/discovery-api.service.ts "Defined in discovery-api.service.ts")
|
||||
|
||||
Gets version and license information for Process Services and Content Services.
|
||||
|
||||
## Class members
|
||||
|
||||
### Methods
|
||||
|
||||
- **getBpmProductInfo**(): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`BpmProductVersionModel`](../../../lib/core/models/product-version.model.ts)`>`<br/>
|
||||
Gets product information for Process Services.
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`BpmProductVersionModel`](../../../lib/core/models/product-version.model.ts)`>` - ProductVersionModel containing product details
|
||||
- **getEcmProductInfo**(): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`EcmProductVersionModel`](../../../lib/core/models/product-version.model.ts)`>`<br/>
|
||||
Gets product information for Content Services.
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`EcmProductVersionModel`](../../../lib/core/models/product-version.model.ts)`>` - ProductVersionModel containing product details
|
||||
|
||||
## Details
|
||||
|
||||
The product license and version information is returned using the
|
||||
classes defined in the [Product Version model](../models/product-version.model.md).
|
||||
See the
|
||||
[Alfresco JS API docs](https://github.com/Alfresco/alfresco-js-api/tree/master/src/alfresco-discovery-rest-api)
|
||||
to learn more about the REST API used by this service.
|
||||
|
||||
## See also
|
||||
|
||||
- [Product version model](../models/product-version.model.md)
|
46
docs/core/services/download-zip.service.md
Normal file
46
docs/core/services/download-zip.service.md
Normal file
@@ -0,0 +1,46 @@
|
||||
---
|
||||
Title: Download zip service
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2019-01-08
|
||||
---
|
||||
|
||||
# [Download zip service](../../../lib/core/services/download-zip.service.ts "Defined in download-zip.service.ts")
|
||||
|
||||
Creates and manages downloads.
|
||||
|
||||
## Class members
|
||||
|
||||
### Methods
|
||||
|
||||
- **cancelDownload**(downloadId: `string`)<br/>
|
||||
Cancels a download.
|
||||
- _downloadId:_ `string` - ID of the target download node
|
||||
- **createDownload**(payload: [`DownloadBodyCreate`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/DownloadBodyCreate.md)): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`DownloadEntry`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/DownloadEntry.md)`>`<br/>
|
||||
Creates a new download.
|
||||
- _payload:_ [`DownloadBodyCreate`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/DownloadBodyCreate.md) - Object containing the node IDs of the items to add to the ZIP file
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`DownloadEntry`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/DownloadEntry.md)`>` - Status object for the download
|
||||
- **getContentUrl**(nodeId: `string`, attachment?: `boolean`): `string`<br/>
|
||||
Gets a content URL for the given node.
|
||||
- _nodeId:_ `string` - [Node](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md) to get URL for.
|
||||
- _attachment:_ `boolean` - (Optional) Toggles whether to retrieve content as an attachment for download
|
||||
- **Returns** `string` - URL string
|
||||
- **getDownload**(downloadId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`DownloadEntry`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/DownloadEntry.md)`>`<br/>
|
||||
Gets status information for a download node.
|
||||
- _downloadId:_ `string` - ID of the download node
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`DownloadEntry`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/DownloadEntry.md)`>` - Status object for the download
|
||||
- **getNode**(nodeId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`NodeEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeEntry.md)`>`<br/>
|
||||
Gets a Node via its node ID.
|
||||
- _nodeId:_ `string` - ID of the target node
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`NodeEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeEntry.md)`>` - Details of the node
|
||||
|
||||
## Details
|
||||
|
||||
Use `createDownload` to create a node that will represent the downloadable
|
||||
ZIP data. The ZIP archive includes the content of all node IDs passed in via
|
||||
the [`DownloadBodyCreate`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/DownloadBodyCreate.md) parameter.
|
||||
|
||||
The [`DownloadEntry`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/DownloadEntry.md) object returned by `createDownload` has an
|
||||
`id` field that you can use to identify the download node (eg,
|
||||
to cancel it later or get the node URL when the download is complete) and
|
||||
other information about the progress of the download.
|
42
docs/core/services/ecm-user.service.md
Normal file
42
docs/core/services/ecm-user.service.md
Normal file
@@ -0,0 +1,42 @@
|
||||
---
|
||||
Title: Ecm User service
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2018-11-19
|
||||
---
|
||||
|
||||
# [Ecm User service](../../../lib/core/userinfo/services/ecm-user.service.ts "Defined in ecm-user.service.ts")
|
||||
|
||||
Gets information about a Content Services user.
|
||||
|
||||
## Class members
|
||||
|
||||
### Methods
|
||||
|
||||
- **getCurrentUserInfo**(): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`EcmUserModel`](../../core/models/ecm-user.model.md)`>`<br/>
|
||||
Gets information about the user who is currently logged-in.
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`EcmUserModel`](../../core/models/ecm-user.model.md)`>` - User information as for getUserInfo
|
||||
- **getUserInfo**(userName: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`EcmUserModel`](../../core/models/ecm-user.model.md)`>`<br/>
|
||||
Gets information about a user identified by their username.
|
||||
- _userName:_ `string` - Target username
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`EcmUserModel`](../../core/models/ecm-user.model.md)`>` - User information
|
||||
- **getUserProfileImage**(avatarId: `string`): `string`<br/>
|
||||
Returns a profile image as a URL.
|
||||
- _avatarId:_ `string` - Target avatar
|
||||
- **Returns** `string` - Image URL
|
||||
|
||||
## Details
|
||||
|
||||
The class returned by `getUserInfo` and `getCurrentUserInfo` is detailed
|
||||
in the [Ecm User model docs](../models/ecm-user.model.md). The `avatarId` passed to
|
||||
`getUserProfileImage` is available as a field of the [`EcmUserModel`](../../core/models/ecm-user.model.md) instance
|
||||
returned for a particular person.
|
||||
|
||||
See the
|
||||
[getPerson](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/PeopleApi.md#getPerson)
|
||||
method in the Alfresco JS API for more information about the REST calls used by this service.
|
||||
|
||||
## See also
|
||||
|
||||
- [Bpm user service](../services/bpm-user.service.md)
|
||||
- [Ecm user model](../models/ecm-user.model.md)
|
48
docs/core/services/favorites-api.service.md
Normal file
48
docs/core/services/favorites-api.service.md
Normal file
@@ -0,0 +1,48 @@
|
||||
---
|
||||
Title: Favorites Api service
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2018-05-04
|
||||
---
|
||||
|
||||
# [Favorites Api service](../../../lib/core/services/favorites-api.service.ts "Defined in favorites-api.service.ts")
|
||||
|
||||
Gets a list of items a user has marked as their favorites.
|
||||
|
||||
## Class members
|
||||
|
||||
### Methods
|
||||
|
||||
- **getFavorites**(personId: `string`, options?: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`NodePaging`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/NodePaging.md)`>`<br/>
|
||||
Gets the favorites for a user.
|
||||
- _personId:_ `string` - ID of the user
|
||||
- _options:_ `any` - (Optional) Options supported by JS-API
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`NodePaging`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/NodePaging.md)`>` - List of favorites
|
||||
- **remapFavoriteEntries**(entries: `any[]`): `any[]`<br/>
|
||||
|
||||
- _entries:_ `any[]` -
|
||||
- **Returns** `any[]` -
|
||||
|
||||
- **remapFavoritesData**(data: `any` = `{}`): [`NodePaging`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/NodePaging.md)<br/>
|
||||
|
||||
- _data:_ `any` -
|
||||
- **Returns** [`NodePaging`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/NodePaging.md) -
|
||||
|
||||
- **remapEntry**(\_\_namedParameters: `Function`): `any`<br/>
|
||||
|
||||
- _\_\_namedParameters:_ `Function` -
|
||||
- **Returns** `any` -
|
||||
|
||||
## Details
|
||||
|
||||
Process Services allows users to mark items as "favorites". These are typically
|
||||
items that are important or frequently used.
|
||||
|
||||
Use `getFavorites` to find a user's favorite items. You could use this, for example,
|
||||
to create a menu for the user to access their favorites quickly rather than by
|
||||
navigating or searching. Using "-me-" for the `personId` indicates that the target
|
||||
person is the currently logged-in user.
|
||||
|
||||
You can specify a number of `options` to modify the search further. See the
|
||||
[Alfresco JS API page](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/FavoritesApi.md#getfavorites)
|
||||
for `getFavorites` for more information.
|
107
docs/core/services/form-rendering.service.md
Normal file
107
docs/core/services/form-rendering.service.md
Normal file
@@ -0,0 +1,107 @@
|
||||
---
|
||||
Title: Form Rendering service
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2018-11-20
|
||||
---
|
||||
|
||||
# [Form Rendering service](../../../lib/core/form/services/form-rendering.service.ts "Defined in form-rendering.service.ts")
|
||||
|
||||
Maps a form field type string onto the corresponding form [widget component](../../insights/widget.component.md) type.
|
||||
|
||||
## Class members
|
||||
|
||||
### Methods
|
||||
|
||||
- **getComponentTypeResolver**(type: `string`, defaultValue: `Type<__type>` = `this.defaultValue`): `DynamicComponentResolveFunction`<br/>
|
||||
Gets the currently active DynamicComponentResolveFunction for a field type.
|
||||
- _type:_ `string` - The type whose resolver you want
|
||||
- _defaultValue:_ `Type<__type>` - Default type returned for types that are not yet mapped
|
||||
- **Returns** `DynamicComponentResolveFunction` - Resolver function
|
||||
- **resolveComponentType**(model: [`DynamicComponentModel`](../../../lib/core/services/dynamic-component-mapper.service.ts), defaultValue: `Type<__type>` = `this.defaultValue`): `Type<__type>`<br/>
|
||||
Finds the component type that is needed to render a form field.
|
||||
- _model:_ [`DynamicComponentModel`](../../../lib/core/services/dynamic-component-mapper.service.ts) - [Form](../../../lib/process-services/task-list/models/form.model.ts) field model for the field to render
|
||||
- _defaultValue:_ `Type<__type>` - Default type returned for field types that are not yet mapped.
|
||||
- **Returns** `Type<__type>` - Component type
|
||||
- **setComponentTypeResolver**(type: `string`, resolver: `DynamicComponentResolveFunction`, override: `boolean` = `true`)<br/>
|
||||
Sets or optionally replaces a DynamicComponentResolveFunction for a field type.
|
||||
- _type:_ `string` - The type whose resolver you want to set
|
||||
- _resolver:_ `DynamicComponentResolveFunction` - The new resolver function
|
||||
- _override:_ `boolean` - The new resolver will only replace an existing one if this parameter is true
|
||||
|
||||
## Details
|
||||
|
||||
The [`Form`](../../../lib/process-services/task-list/models/form.model.ts) Field component uses this service to choose which widget to use to render an instance of a
|
||||
form field. The [`Form`](../../../lib/process-services/task-list/models/form.model.ts) Field model stores the field type name as a string (see the table below).
|
||||
The [`Form`](../../../lib/process-services/task-list/models/form.model.ts) Rendering service maintains a mapping between each type name and
|
||||
a corresponding `DynamicComponentResolveFunction`. The function takes a [`FormFieldModel`](../../core/models/form-field.model.md) object as its argument and
|
||||
uses the data from the object to determine which widget should be used to render the field.
|
||||
|
||||
In some cases, the field type string alone is enough to determine the widget type and so the function
|
||||
just returns the type directly:
|
||||
|
||||
```ts
|
||||
let customResolver: DynamicComponentResolveFunction = () => CustomWidgetComponent;
|
||||
formRenderingService.setComponentTypeResolver('text', customResolver, true);
|
||||
```
|
||||
|
||||
In other cases, the function may need to choose the widget dynamically based on
|
||||
specific values in the form data:
|
||||
|
||||
```ts
|
||||
let customResolver: DynamicComponentResolveFunction = (field: FormFieldModel): Type<{}> => {
|
||||
if (field) {
|
||||
let params = field.params;
|
||||
}
|
||||
return UnknownWidgetComponent;
|
||||
};
|
||||
formRenderingService.setComponentTypeResolver('text', customResolver, true);
|
||||
```
|
||||
|
||||
### Default type mapping
|
||||
|
||||
The [`Form`](../../../lib/process-services/task-list/models/form.model.ts) Rendering service is initialized with the mapping shown in the table below:
|
||||
|
||||
| Stencil name | Field type string | Component type |
|
||||
| ------------ | ----------------- | -------------- |
|
||||
| Amount | "amount" | [`AmountWidgetComponent`](../../../lib/core/form/components/widgets/amount/amount.widget.ts) |
|
||||
| Attach | "upload" | AttachWidgetComponent or [`UploadWidgetComponent`](../../../lib/core/form/components/widgets/upload/upload.widget.ts) (based on metadata) |
|
||||
| Checkbox | "boolean" | [`CheckboxWidgetComponent`](../../../lib/core/form/components/widgets/checkbox/checkbox.widget.ts) |
|
||||
| Date | "date" | [`DateWidgetComponent`](../../../lib/core/form/components/widgets/date/date.widget.ts) |
|
||||
| Display text | "readonly-text" | [`DisplayTextWidgetComponentComponent`](../../../lib/core/form/components/widgets/display-text/display-text.widget.ts) |
|
||||
| Display value | "readonly" | DisplayValueWidgetComponent |
|
||||
| Dropdown | "dropdown" | [`DropdownWidgetComponent`](../../../lib/core/form/components/widgets/dropdown/dropdown.widget.ts) |
|
||||
| Dynamic table | "dynamic-table" | [`DynamicTableWidgetComponent`](../../../lib/core/form/components/widgets/dynamic-table/dynamic-table.widget.ts) |
|
||||
| Group of people | "functional-group" | [`FunctionalGroupWidgetComponent`](../../../lib/core/form/components/widgets/functional-group/functional-group.widget.ts) |
|
||||
| Header | "group" | [`ContainerWidgetComponent`](../../../lib/core/form/components/widgets/container/container.widget.ts) |
|
||||
| Hyperlink | "hyperlink" | [`HyperlinkWidgetComponent`](../../../lib/core/form/components/widgets/hyperlink/hyperlink.widget.ts) |
|
||||
| Multi-line text | "multi-line-text" | [`MultilineTextWidgetComponentComponent`](../../../lib/core/form/components/widgets/multiline-text/multiline-text.widget.ts) |
|
||||
| Number | "integer" | [`NumberWidgetComponent`](../../../lib/core/form/components/widgets/number/number.widget.ts) |
|
||||
| People | "people" | [`PeopleWidgetComponent`](../../../lib/core/form/components/widgets/people/people.widget.ts) |
|
||||
| Radio buttons | "radio-buttons" | [`RadioButtonsWidgetComponent`](../../../lib/core/form/components/widgets/radio-buttons/radio-buttons.widget.ts) |
|
||||
| Text | "text" | [`TextWidgetComponent`](../../../lib/core/form/components/widgets/text/text.widget.ts) |
|
||||
| Typeahead | "typeahead" | [`TypeaheadWidgetComponent`](../../../lib/core/form/components/widgets/typeahead/typeahead.widget.ts) |
|
||||
|
||||
You can add new items to the mapping or replace existing items in order to customize the way
|
||||
fields are rendered.
|
||||
|
||||
### Adding new or replacement items to the mapping
|
||||
|
||||
You can use the `setComponentTypeResolver` method to add a new ComponentTypeResolver function for a
|
||||
particular type string. You can also replace the resolver for a type that already exists in the mapping
|
||||
if you set the `override` parameter to 'true':
|
||||
|
||||
```ts
|
||||
formRenderingService.setComponentTypeResolver('text', newResolver, true);
|
||||
```
|
||||
|
||||
You would typically use this to replace an existing widget with your own custom version that
|
||||
implements a modified layout or responds differently when the data is entered. See the
|
||||
[Form Extensibility and Customisation](../../user-guide/extensibility.md) guide for further details and examples
|
||||
of this technique.
|
||||
|
||||
## See also
|
||||
|
||||
- [Extensibility](../../user-guide/extensibility.md)
|
||||
- [Form field model](../models/form-field.model.md)
|
||||
- [Form component](../components/form.component.md)
|
155
docs/core/services/form.service.md
Normal file
155
docs/core/services/form.service.md
Normal file
@@ -0,0 +1,155 @@
|
||||
---
|
||||
Title: Form service
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
---
|
||||
|
||||
# [Form service](../../../lib/core/form/services/form.service.ts "Defined in form.service.ts")
|
||||
|
||||
Implements Process Services form methods
|
||||
|
||||
## Basic Usage
|
||||
|
||||
```ts
|
||||
import { FormService, FormEvent, FormFieldEvent } from '@alfresco/adf-core';
|
||||
|
||||
@Component(...)
|
||||
class MyComponent {
|
||||
|
||||
constructor(formService: FormService) {
|
||||
|
||||
formService.formLoaded.subscribe(
|
||||
(e: FormEvent) => {
|
||||
console.log(`Form loaded: ${e.form.id}`);
|
||||
}
|
||||
);
|
||||
|
||||
formService.formFieldValueChanged.subscribe(
|
||||
(e: FormFieldEvent) => {
|
||||
console.log(`Field value changed. Form: ${e.form.id}, Field: ${e.field.id}, Value: ${e.field.value}`);
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
### Events
|
||||
|
||||
| Name | Args Type | Description |
|
||||
| ---- | --------- | ----------- |
|
||||
| formLoaded | [`FormEvent`](../../../lib/core/form/events/form.event.ts) | Raised when form has been loaded or reloaded |
|
||||
| formFieldValueChanged | [`FormFieldEvent`](../../../lib/core/form/events/form-field.event.ts) | Raised when input values change |
|
||||
| taskCompleted | [`FormEvent`](../../../lib/core/form/events/form.event.ts) | Raised when a task is completed successfully |
|
||||
| taskCompletedError | [`FormErrorEvent`](../../../lib/core/form/events/form-error.event.ts) | Raised when a task is completed unsuccessfully |
|
||||
| taskSaved | [`FormEvent`](../../../lib/core/form/events/form.event.ts) | Raised when a task is saved successfully |
|
||||
| taskSavedError | [`FormErrorEvent`](../../../lib/core/form/events/form-error.event.ts) | Raised when a task is saved unsuccessfully |
|
||||
| executeOutcome | [`FormOutcomeEvent`](../../../lib/core/form/components/widgets/core/form-outcome-event.model.ts) | Raised when a form outcome is executed |
|
||||
| formEvents | Event | You can subscribe to this event to listen : ( click, blur, change, focus, focusin, focusout, input, invalid, select) of any elements in the form , see doc below |
|
||||
| validateForm | [`ValidateFormEvent`](../../../lib/core/form/events/validate-form.event.ts) | Raised each time a form is validated. You can use it to provide custom validation or prevent default behaviour. |
|
||||
| validateFormField | [`ValidateFormFieldEvent`](../../../lib/core/form/events/validate-form-field.event.ts) | Raised each time a form field is validated. You can use it to provide custom validation or prevent default behaviour. |
|
||||
|
||||
### Methods
|
||||
|
||||
- `parseForm(json: any, data?:`[`FormValues,`](../../../lib/core/form/components/widgets/core/form-values.ts)`readOnly: boolean = false):`[`FormModel`](../../../lib/core/form/components/widgets/core/form.model.ts)
|
||||
Parses JSON data to create a corresponding [`Form`](../../../lib/process-services/task-list/models/form.model.ts) model.
|
||||
- `json` - JSON to create the form
|
||||
- `data` - (Optional) Values for the form fields
|
||||
- `readOnly` - Should the form fields be read-only?
|
||||
- `createFormFromANode(formName: string):`[`Observable`](http://reactivex.io/documentation/observable.html)`<any>`
|
||||
Create a [`Form`](../../../lib/process-services/task-list/models/form.model.ts) with a field for each metadata property.
|
||||
- `formName` - Name of the new form
|
||||
- `createForm(formName: string):`[`Observable`](http://reactivex.io/documentation/observable.html)`<any>`
|
||||
Create a [`Form`](../../../lib/process-services/task-list/models/form.model.ts).
|
||||
- `formName` - Name of the new form
|
||||
- `saveForm(formId: string, formModel: FormDefinitionModel):`[`Observable`](http://reactivex.io/documentation/observable.html)`<any>`
|
||||
Saves a form.
|
||||
- `formId` - ID of the form to save
|
||||
- `formModel` - Model data for the form
|
||||
- `searchFrom(name: string):`[`Observable`](http://reactivex.io/documentation/observable.html)`<any>`
|
||||
Search for a form by name.
|
||||
- `name` - The form name to search for
|
||||
- `getForms():`[`Observable`](http://reactivex.io/documentation/observable.html)`<any>`
|
||||
Gets all the forms.
|
||||
|
||||
- `getProcessDefinitions():`[`Observable`](http://reactivex.io/documentation/observable.html)`<any>`
|
||||
Get Process Definitions
|
||||
|
||||
- `getProcessVariablesById(processInstanceId: string):`[`Observable`](http://reactivex.io/documentation/observable.html)`<any[]>`
|
||||
Get instance variables for a process.
|
||||
- `processInstanceId` - ID of the target process
|
||||
- `getTasks():`[`Observable`](http://reactivex.io/documentation/observable.html)`<any>`
|
||||
Gets all the tasks.
|
||||
|
||||
- `getTask(taskId: string):`[`Observable`](http://reactivex.io/documentation/observable.html)`<any>`
|
||||
Gets a task.
|
||||
- `taskId` - Task Id
|
||||
- `saveTaskForm(taskId: string, formValues: FormValues):`[`Observable`](http://reactivex.io/documentation/observable.html)`<any>`
|
||||
Save Task [`Form`](../../../lib/process-services/task-list/models/form.model.ts).
|
||||
- `taskId` - Task Id
|
||||
- `formValues` - [`Form`](../../../lib/process-services/task-list/models/form.model.ts) Values
|
||||
- `completeTaskForm(taskId: string, formValues:`[`FormValues,`](../../../lib/core/form/components/widgets/core/form-values.ts)`outcome?: string):`[`Observable`](http://reactivex.io/documentation/observable.html)`<any>`
|
||||
Complete Task [`Form`](../../../lib/process-services/task-list/models/form.model.ts)
|
||||
- `taskId` - Task Id
|
||||
- `formValues` - [`Form`](../../../lib/process-services/task-list/models/form.model.ts) Values
|
||||
- `outcome` - (Optional) [`Form`](../../../lib/process-services/task-list/models/form.model.ts) Outcome
|
||||
- `getTaskForm(taskId: string):`[`Observable`](http://reactivex.io/documentation/observable.html)`<any>`
|
||||
Get [`Form`](../../../lib/process-services/task-list/models/form.model.ts) related to a taskId
|
||||
- `taskId` - Task Id
|
||||
- `getFormDefinitionById(formId: string):`[`Observable`](http://reactivex.io/documentation/observable.html)`<any>`
|
||||
Get [`Form`](../../../lib/process-services/task-list/models/form.model.ts) Definition
|
||||
- `formId` - [`Form`](../../../lib/process-services/task-list/models/form.model.ts) Id
|
||||
- `getFormDefinitionByName(name: string):`[`Observable`](http://reactivex.io/documentation/observable.html)`<any>`
|
||||
Returns form definition with a given name.
|
||||
- `name` - The form name
|
||||
- `getStartFormInstance(processId: string):`[`Observable`](http://reactivex.io/documentation/observable.html)`<any>`
|
||||
Get start form instance for a given processId
|
||||
- `processId` - Process definition ID
|
||||
- `getProcessInstance(processId: string):`[`Observable`](http://reactivex.io/documentation/observable.html)`<any>`
|
||||
Gets a process instance.
|
||||
- `processId` - ID of the process to get
|
||||
- `getStartFormDefinition(processId: string):`[`Observable`](http://reactivex.io/documentation/observable.html)`<any>`
|
||||
Get start form definition for a given process
|
||||
- `processId` - Process definition ID
|
||||
- `getRestFieldValues(taskId: string, field: string):`[`Observable`](http://reactivex.io/documentation/observable.html)`<any>`
|
||||
Gets values of fields populated by a REST backend.
|
||||
- `taskId` - Task identifier
|
||||
- `field` - Field identifier
|
||||
- `getRestFieldValuesByProcessId(processDefinitionId: string, field: string):`[`Observable`](http://reactivex.io/documentation/observable.html)`<any>`
|
||||
Gets values of fields populated by a REST backend using a process ID.
|
||||
- `processDefinitionId` - Process identifier
|
||||
- `field` - Field identifier
|
||||
- `getRestFieldValuesColumnByProcessId(processDefinitionId: string, field: string, column?: string):`[`Observable`](http://reactivex.io/documentation/observable.html)`<any>`
|
||||
Gets column values of fields populated by a REST backend using a process ID.
|
||||
- `processDefinitionId` - Process identifier
|
||||
- `field` - Field identifier
|
||||
- `column` - (Optional) Column identifier
|
||||
- `getRestFieldValuesColumn(taskId: string, field: string, column?: string):`[`Observable`](http://reactivex.io/documentation/observable.html)`<any>`
|
||||
Gets column values of fields populated by a REST backend.
|
||||
- `taskId` - Task identifier
|
||||
- `field` - Field identifier
|
||||
- `column` - (Optional) Column identifier
|
||||
- `getUserProfileImageApi(userId: number): string`
|
||||
Returns a URL for the profile picture of a user.
|
||||
- `userId` - ID of the target user
|
||||
- [`getWorkflowUsers(filter: string, groupId?: string): Observable<UserProcessModel[]>`](../../core/models/user-process.model.md)
|
||||
Gets a list of workflow users.
|
||||
- `filter` - Filter to select specific users
|
||||
- `groupId` - (Optional) Group ID for the search
|
||||
- [`getWorkflowGroups(filter: string, groupId?: string): Observable<GroupModel[]>`](../../../lib/process-services-cloud/src/lib/group/models/group.model.ts)
|
||||
Gets a list of groups in a workflow.
|
||||
- `filter` - Filter to select specific groups
|
||||
- `groupId` - (Optional) Group ID for the search
|
||||
- `getFormId(res: any): string`
|
||||
Gets the ID of a form.
|
||||
- `res` - Object representing a form
|
||||
- `toJson(res: any): any`
|
||||
Creates a JSON representation of form data.
|
||||
- `res` - Object representing form data
|
||||
- `toJsonArray(res: any): any`
|
||||
Creates a JSON array representation of form data.
|
||||
- `res` - Object representing form data
|
||||
- `handleError(error: any):`[`Observable`](http://reactivex.io/documentation/observable.html)`<any>`
|
||||
Reports an error message.
|
||||
- `error` - Data object with optional \`message\` and \`status\` fields for the error
|
52
docs/core/services/highlight-transform.service.md
Normal file
52
docs/core/services/highlight-transform.service.md
Normal file
@@ -0,0 +1,52 @@
|
||||
---
|
||||
Title: Highlight Transform service
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2018-11-13
|
||||
---
|
||||
|
||||
# [Highlight Transform service](../../../lib/core/services/highlight-transform.service.ts "Defined in highlight-transform.service.ts")
|
||||
|
||||
Adds HTML to a string to highlight chosen sections.
|
||||
|
||||
## Class members
|
||||
|
||||
### Methods
|
||||
|
||||
- **highlight**(text: `string`, search: `string`, wrapperClass: `string` = `"adf-highlight"`): [`HighlightTransformResult`](../../../lib/core/services/highlight-transform.service.ts)<br/>
|
||||
Searches for `search` string(s) within `text` and highlights all occurrences.
|
||||
- _text:_ `string` - Text to search within
|
||||
- _search:_ `string` - Text pattern to search for
|
||||
- _wrapperClass:_ `string` - CSS class used to provide highlighting style
|
||||
- **Returns** [`HighlightTransformResult`](../../../lib/core/services/highlight-transform.service.ts) - New text along with boolean value to indicate whether anything was highlighted
|
||||
|
||||
## Details
|
||||
|
||||
A typical use case for this service is to display the results from a search engine.
|
||||
An excerpt of a retrieved document can be shown with the matching search terms
|
||||
highlighted to indicate where they were found.
|
||||
|
||||
The service works by adding HTML <span> elements around all sections of text
|
||||
that match the `search` string. You can specify multiple search strings at once by
|
||||
separating them with spaces, so passing "Apple Banana Cherry" in `search` will
|
||||
highlight any of those words individually. The <span> element includes a
|
||||
`class` attribute which defaults to "highlight" but you can pass any class name
|
||||
you like using the `wrapperClass` parameter.
|
||||
|
||||
The resulting text with HTML highlighting is returned within a [`HighlightTransformResult`](../../../lib/core/services/highlight-transform.service.ts)
|
||||
object:
|
||||
|
||||
```ts
|
||||
interface HighlightTransformResult {
|
||||
text: string;
|
||||
changed: boolean;
|
||||
}
|
||||
```
|
||||
|
||||
The `changed` flag will be false if the search string was not found (ie, no highlighting
|
||||
took place) and true otherwise.
|
||||
|
||||
## See also
|
||||
|
||||
- [Text highlight pipe](../pipes/text-highlight.pipe.md)
|
||||
- [Highlight directive](../directives/highlight.directive.md)
|
32
docs/core/services/identity-user.service.md
Normal file
32
docs/core/services/identity-user.service.md
Normal file
@@ -0,0 +1,32 @@
|
||||
---
|
||||
Title: Identity user service
|
||||
Added: v3.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2019-02-08
|
||||
---
|
||||
|
||||
# [Identity user service](../../../lib/process-services-cloud/src/lib/services/identity-user.service.ts "Defined in identity-user.service.ts")
|
||||
|
||||
Gets OAuth2 personal details and roles for users.
|
||||
|
||||
## Class members
|
||||
|
||||
### Methods
|
||||
|
||||
- **findUsersByUsername**(username: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
|
||||
Finds groups filtered by username.
|
||||
- _username:_ `string` - Object containing the name filter string
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - List of users information
|
||||
|
||||
## Details
|
||||
|
||||
[OAuth2](https://oauth.net/2/) defines an _access token_ (used when
|
||||
authenticating a user) and a number of _authentication roles_ that the user
|
||||
can participate in (see
|
||||
[this page](https://www.digitalocean.com/community/tutorials/an-introduction-to-oauth-2)
|
||||
for an introduction to OAuth2 and a description of the roles). You can use the
|
||||
[Identity user service](identity-user.service.md) to access this information for users, including the current user.
|
||||
|
||||
## See also
|
||||
|
||||
- [JWT helper service](jwt-helper.service.md)
|
29
docs/core/services/jwt-helper.service.md
Normal file
29
docs/core/services/jwt-helper.service.md
Normal file
@@ -0,0 +1,29 @@
|
||||
---
|
||||
Title: JWT helper service
|
||||
Added: v3.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2019-01-09
|
||||
---
|
||||
|
||||
# [JWT helper service](../../../lib/core/services/jwt-helper.service.ts "Defined in jwt-helper.service.ts")
|
||||
|
||||
Decodes a JSON Web Token (JWT) to a JavaScript object.
|
||||
|
||||
## Class members
|
||||
|
||||
### Methods
|
||||
|
||||
- **decodeToken**(token: `any`): `Object`<br/>
|
||||
Decodes a JSON web token into a JS object.
|
||||
- _token:_ `any` - Token in encoded form
|
||||
- **Returns** `Object` - Decoded token data object
|
||||
|
||||
## Details
|
||||
|
||||
JWT is a standard for sending data securely that ADF uses during the
|
||||
OAuth2 authentication procedure. See the [JWT website](https://jwt.io/)
|
||||
for full details of the standard and its uses.
|
||||
|
||||
## See also
|
||||
|
||||
- [Identity user service](identity-user.service.md)
|
146
docs/core/services/log.service.md
Normal file
146
docs/core/services/log.service.md
Normal file
@@ -0,0 +1,146 @@
|
||||
---
|
||||
Title: Log Service
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2018-06-08
|
||||
---
|
||||
|
||||
# [Log Service](../../../lib/core/services/log.service.ts "Defined in log.service.ts")
|
||||
|
||||
Provides log functionality.
|
||||
|
||||
## Basic Usage
|
||||
|
||||
**app.component.ts**
|
||||
|
||||
```ts
|
||||
import { LogService } from '@alfresco/adf-core';
|
||||
|
||||
@Component({...})
|
||||
export class AppComponent {
|
||||
|
||||
constructor(logService: LogService) {
|
||||
}
|
||||
|
||||
myMethod(){
|
||||
this.logService.error('My error');
|
||||
this.logService.trace('My trace')
|
||||
this.logService.debug('My debug')
|
||||
this.logService.info('My info')
|
||||
this.logService.warn('My warn')
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
```ts
|
||||
import { LogService } from '@alfresco/adf-core';
|
||||
|
||||
@Component({...})
|
||||
export class AppComponent {
|
||||
|
||||
constructor(logService: LogService, myIntegrationService: MyIntegrationService)) {
|
||||
logService.onMessage.subscribe((message) => {
|
||||
myIntegrationService.send(message.text,message.type);
|
||||
});
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Class members
|
||||
|
||||
### Methods
|
||||
|
||||
- **assert**(test?: `boolean`, message?: `string`, optionalParams: `any[]`)<br/>
|
||||
Logs a message if a boolean test fails.
|
||||
- _test:_ `boolean` - (Optional) Test value (typically a boolean expression)
|
||||
- _message:_ `string` - (Optional) Message to show if test is false
|
||||
- _optionalParams:_ `any[]` - Interpolation values for the message in "printf" format
|
||||
- **debug**(message?: `any`, optionalParams: `any[]`)<br/>
|
||||
Logs a message at the "DEBUG" level.
|
||||
- _message:_ `any` - (Optional) Message to log
|
||||
- _optionalParams:_ `any[]` - Interpolation values for the message in "printf" format
|
||||
- **error**(message?: `any`, optionalParams: `any[]`)<br/>
|
||||
Logs a message at the "ERROR" level.
|
||||
- _message:_ `any` - (Optional) Message to log
|
||||
- _optionalParams:_ `any[]` - Interpolation values for the message in "printf" format
|
||||
- **getLogLevel**(level: `string`): [`LogLevelsEnum`](../../../lib/core/models/log-levels.model.ts)<br/>
|
||||
Converts a log level name string into its numeric equivalent.
|
||||
- _level:_ `string` - Level name
|
||||
- **Returns** [`LogLevelsEnum`](../../../lib/core/models/log-levels.model.ts) - Numeric log level
|
||||
- **group**(groupTitle?: `string`, optionalParams: `any[]`)<br/>
|
||||
Starts an indented group of log messages.
|
||||
- _groupTitle:_ `string` - (Optional) Title shown at the start of the group
|
||||
- _optionalParams:_ `any[]` - Interpolation values for the title in "printf" format
|
||||
- **groupEnd**()<br/>
|
||||
Ends a indented group of log messages.
|
||||
- **info**(message?: `any`, optionalParams: `any[]`)<br/>
|
||||
Logs a message at the "INFO" level.
|
||||
- _message:_ `any` - (Optional) Message to log
|
||||
- _optionalParams:_ `any[]` - Interpolation values for the message in "printf" format
|
||||
- **log**(message?: `any`, optionalParams: `any[]`)<br/>
|
||||
Logs a message at any level from "TRACE" upwards.
|
||||
- _message:_ `any` - (Optional) Message to log
|
||||
- _optionalParams:_ `any[]` - Interpolation values for the message in "printf" format
|
||||
- **messageBus**(text: `string`, logLevel: `string`)<br/>
|
||||
Triggers notification callback for log messages.
|
||||
- _text:_ `string` - Message text
|
||||
- _logLevel:_ `string` - Log level for the message
|
||||
- **trace**(message?: `any`, optionalParams: `any[]`)<br/>
|
||||
Logs a message at the "TRACE" level.
|
||||
- _message:_ `any` - (Optional) Message to log
|
||||
- _optionalParams:_ `any[]` - Interpolation values for the message in "printf" format
|
||||
- **warn**(message?: `any`, optionalParams: `any[]`)<br/>
|
||||
Logs a message at the "WARN" level.
|
||||
- _message:_ `any` - (Optional) Message to log
|
||||
- _optionalParams:_ `any[]` - Interpolation values for the message in "printf" format
|
||||
|
||||
## Details
|
||||
|
||||
### Log levels
|
||||
|
||||
There are 6 levels of logs that you can use:
|
||||
|
||||
| Name | Level |
|
||||
| ---- | ----- |
|
||||
| TRACE | 5 |
|
||||
| DEBUG | 4 |
|
||||
| INFO | 3 |
|
||||
| WARN | 2 |
|
||||
| ERROR | 1 |
|
||||
| SILENT | 0 |
|
||||
|
||||
You can set the default log level using the **_logLevel_** property in `app.config.json`.
|
||||
The factory setting for this property is `TRACE`.
|
||||
|
||||
For example, you can set the default log level to `WARNING` as follows:
|
||||
|
||||
**app.config.json**
|
||||
|
||||
```json
|
||||
{
|
||||
"logLevel": "WARN"
|
||||
}
|
||||
```
|
||||
|
||||
### Log message bus
|
||||
|
||||
The [log service](log.service.md) also provides an
|
||||
[`Observable`](http://reactivex.io/documentation/observable.html) called `_onMessage_`
|
||||
that you can subscribe to if you want to receive all the log messages.
|
||||
The message object passed as a parameter to the `onMessage` handler has the following format:
|
||||
|
||||
```ts
|
||||
{
|
||||
text: "Message log text"
|
||||
type: "ERROR|DEBUG|INFO|LOG|TRACE|WARN|ASSERT"
|
||||
}
|
||||
```
|
||||
|
||||
### Using the log to feed analytics
|
||||
|
||||
You can pass the log output to an analytics system to collect error and assertion data
|
||||
from apps as they run. This can help you spot which problems users are running into most
|
||||
often and the situations in which they occur. See the tutorial about
|
||||
[integrating the log service with analytics](https://community.alfresco.com/community/application-development-framework/blog/2018/05/01/how-to-integrate-adf-log-service-with-mixpanel-analytics-service)
|
||||
on the Alfresco Community site for further information.
|
31
docs/core/services/login-dialog.service.md
Normal file
31
docs/core/services/login-dialog.service.md
Normal file
@@ -0,0 +1,31 @@
|
||||
---
|
||||
Title: Login Dialog service
|
||||
Added: v2.6.0
|
||||
Status: Active
|
||||
Last reviewed: 2019-02-08
|
||||
---
|
||||
|
||||
# [Login Dialog service](../../../lib/core/services/login-dialog.service.ts "Defined in login-dialog.service.ts")
|
||||
|
||||
Manages login dialogs.
|
||||
|
||||
## Methods
|
||||
|
||||
- **openLogin**(actionName: `string`, title: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<string>`<br/>
|
||||
Opens a login dialog.
|
||||
- _actionName:_ `string` - Text to show in the main action button
|
||||
- _title:_ `string` - Title for the login dialog
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<string>` - Confirmation of login from the dialog
|
||||
- **close**(): `<void>`<br/>
|
||||
Closes the currently open login dialog.
|
||||
|
||||
## Details
|
||||
|
||||
Use the methods of this service to manage login dialogs from code. As an alternative, you may
|
||||
find it easier to use the [Login dialog component](../components/login-dialog.component.md) to display the
|
||||
dialog directly from HTML.
|
||||
|
||||
## See also
|
||||
|
||||
- [Login dialog component](../components/login-dialog.component.md)
|
||||
- [Login component](../components/login.component.md)
|
57
docs/core/services/node.service.md
Normal file
57
docs/core/services/node.service.md
Normal file
@@ -0,0 +1,57 @@
|
||||
---
|
||||
Title: Node Service
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2018-11-20
|
||||
---
|
||||
|
||||
# [Node Service](../../../lib/core/form/services/node.service.ts "Defined in node.service.ts")
|
||||
|
||||
Gets Alfresco Repository node metadata and creates nodes with metadata.
|
||||
|
||||
## Class members
|
||||
|
||||
### Methods
|
||||
|
||||
- **createNode**(name: `string`, nodeType: `string`, properties: `any`, path: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`NodeEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeEntry.md)`>`<br/>
|
||||
Create a new Node from form metadata
|
||||
- _name:_ `string` - [Node](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md) name
|
||||
- _nodeType:_ `string` - [Node](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md) type
|
||||
- _properties:_ `any` - [Node](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md) body properties
|
||||
- _path:_ `string` - Path to the node
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`NodeEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeEntry.md)`>` - The created node
|
||||
- **createNodeMetadata**(nodeType: `string`, nameSpace: `any`, data: `any`, path: `string`, name?: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`NodeEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeEntry.md)`>`<br/>
|
||||
Create a new Node from form metadata.
|
||||
- _nodeType:_ `string` - [Node](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md) type
|
||||
- _nameSpace:_ `any` - Namespace for properties
|
||||
- _data:_ `any` - [Property](../../../lib/content-services/content-metadata/interfaces/property.interface.ts) data to store in the node under namespace
|
||||
- _path:_ `string` - Path to the node
|
||||
- _name:_ `string` - (Optional) [Node](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md) name
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`NodeEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeEntry.md)`>` - The created node
|
||||
- **getNodeMetadata**(nodeId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`NodeMetadata`](../../../lib/core/form/models/node-metadata.model.ts)`>`<br/>
|
||||
Get the metadata and the nodeType for a nodeId cleaned by the prefix.
|
||||
- _nodeId:_ `string` - ID of the target node
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`NodeMetadata`](../../../lib/core/form/models/node-metadata.model.ts)`>` - Node metadata
|
||||
|
||||
## Details
|
||||
|
||||
Note that this service cannot be used to create nodes with content.
|
||||
|
||||
The `path` parameter to `createNode` and `createNodeMetadata` specifies an intermediate
|
||||
path of folders to create between the root and the target node.
|
||||
|
||||
### Importing
|
||||
|
||||
```ts
|
||||
import { NodeService } from '@alfresco/adf-core';
|
||||
|
||||
export class SomePageComponent implements OnInit {
|
||||
|
||||
constructor(private nodeService: NodeService) {
|
||||
}
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
- [Nodes api service](nodes-api.service.md)
|
||||
- [Deleted nodes api service](deleted-nodes-api.service.md)
|
192
docs/core/services/nodes-api.service.md
Normal file
192
docs/core/services/nodes-api.service.md
Normal file
@@ -0,0 +1,192 @@
|
||||
---
|
||||
Title: Nodes Api service
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2019-01-16
|
||||
---
|
||||
|
||||
# [Nodes Api service](../../../lib/core/services/nodes-api.service.ts "Defined in nodes-api.service.ts")
|
||||
|
||||
Accesses and manipulates ACS document nodes using their node IDs.
|
||||
|
||||
## Contents
|
||||
|
||||
- [Class members](#class-members)
|
||||
- [Methods](#methods)
|
||||
- [Details](#details)
|
||||
- [Getting node information](#getting-node-information)
|
||||
- [Getting folder node contents](#getting-folder-node-contents)
|
||||
- [Creating and updating nodes](#creating-and-updating-nodes)
|
||||
- [Deleting and restoring nodes](#deleting-and-restoring-nodes)
|
||||
- [See also](#see-also)
|
||||
|
||||
## Class members
|
||||
|
||||
### Methods
|
||||
|
||||
- **createFolder**(parentNodeId: `string`, nodeBody: `any`, options: `any` = `{}`): [`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)`>`<br/>
|
||||
Creates a new folder node inside a parent folder.
|
||||
- _parentNodeId:_ `string` - ID of the parent folder node
|
||||
- _nodeBody:_ `any` - Data for the new folder
|
||||
- _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)`>` - Details of the new folder
|
||||
- **createNode**(parentNodeId: `string`, nodeBody: `any`, options: `any` = `{}`): [`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)`>`<br/>
|
||||
Creates a new document node inside a folder.
|
||||
- _parentNodeId:_ `string` - ID of the parent folder node
|
||||
- _nodeBody:_ `any` - Data for the new node
|
||||
- _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)`>` - Details of the new node
|
||||
- **deleteNode**(nodeId: `string`, options: `any` = `{}`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
|
||||
Moves a node to the trashcan.
|
||||
- _nodeId:_ `string` - ID of the target node
|
||||
- _options:_ `any` - Optional parameters supported by JS-API
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - Empty result that notifies when the deletion is complete
|
||||
- **getNode**(nodeId: `string`, options: `any` = `{}`): [`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)`>`<br/>
|
||||
Gets the stored information about a node.
|
||||
- _nodeId:_ `string` - ID of the target node
|
||||
- _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)`>` - Node information
|
||||
- **getNodeChildren**(nodeId: `string`, options: `any` = `{}`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`NodePaging`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/NodePaging.md)`>`<br/>
|
||||
Gets the items contained in a folder node.
|
||||
- _nodeId:_ `string` - ID of the target node
|
||||
- _options:_ `any` - Optional parameters supported by JS-API
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`NodePaging`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/NodePaging.md)`>` - List of child items from the folder
|
||||
- **restoreNode**(nodeId: `string`): [`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)`>`<br/>
|
||||
Restores a node previously moved to the trashcan.
|
||||
- _nodeId:_ `string` - ID of the node to restore
|
||||
- **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)`>` - Details of the restored node
|
||||
- **updateNode**(nodeId: `string`, nodeBody: `any`, options: `any` = `{}`): [`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)`>`<br/>
|
||||
Updates the information about a node.
|
||||
- _nodeId:_ `string` - ID of the target node
|
||||
- _nodeBody:_ `any` - New data for the node
|
||||
- _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
|
||||
|
||||
## Details
|
||||
|
||||
Each node (ie, document or folder) in an ACS repository is identified by
|
||||
its own unique node ID value. The ID is a long string of hex values separated
|
||||
by dashes, eg:
|
||||
|
||||
`53ef6110-ed9c-4739-a520-e7b4336229c0`
|
||||
|
||||
The string is convenient for storage, for passing as an
|
||||
[Angular route parameter](https://angular.io/guide/router)
|
||||
and other purposes but doesn't enable you to do very much with the node itself.
|
||||
The [Nodes Api Service](nodes-api.service.md) has methods for getting information about nodes and
|
||||
managing them within the repository (creating, deleting, etc).
|
||||
|
||||
Other lower level interfaces to the ACS nodes API are also available - see the
|
||||
[Alfresco Api service](alfresco-api.service.md), the
|
||||
[Alfresco JS API docs](https://github.com/Alfresco/alfresco-js-api/tree/master/src/alfresco-core-rest-api)
|
||||
and the
|
||||
[REST API Explorer](https://api-explorer.alfresco.com/api-explorer/#/nodes)
|
||||
for more information.
|
||||
|
||||
### Getting node information
|
||||
|
||||
The `getNode` method gives access to the [`MinimalNode`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeMinimalEntry.md) object that represents the
|
||||
details of a node:
|
||||
|
||||
```ts
|
||||
interface MinimalNode extends Node {
|
||||
id: string;
|
||||
parentId: string;
|
||||
name: string;
|
||||
nodeType: string;
|
||||
isFolder: boolean;
|
||||
isFile: boolean;
|
||||
modifiedAt: Date;
|
||||
modifiedByUser: UserInfo;
|
||||
createdAt: Date;
|
||||
createdByUser: UserInfo;
|
||||
content: ContentInfo;
|
||||
path: PathInfoEntity;
|
||||
properties: NodeProperties;
|
||||
}
|
||||
```
|
||||
|
||||
This provides useful information about the node, such as its name, creation and
|
||||
modification dates, etc. Also, the `id` and `parentId` properties contain the node
|
||||
ID strings for the current node and its enclosing folder.
|
||||
|
||||
Sometimes, a [`MinimalNode`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeMinimalEntry.md) is provided directly, for example, the `folderNode` property
|
||||
of a [Document List component](../../content-services/document-list.component.md) or the data context of a
|
||||
[Document List row](../../content-services/document-list.component.md#underlying-node-object). In these cases,
|
||||
you might pass the `id` or `parentId` as a [route parameter](https://angular.io/guide/router)
|
||||
to a page describing the node in full detail. The component receiving the node ID can
|
||||
use the [Nodes Api service](nodes-api.service.md) to "decode" the ID string into a [`MinimalNode`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeMinimalEntry.md):
|
||||
|
||||
```ts
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { NodesApiService } from '@alfresco/adf-core';
|
||||
import { MinimalNode } from '@alfresco/js-api';
|
||||
...
|
||||
|
||||
export class RepositoryDetailsPageComponent implements OnInit {
|
||||
nodeId: string;
|
||||
nodeName: string;
|
||||
isFile: boolean;
|
||||
...
|
||||
|
||||
constructor(private router: Router,
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private nodeService: NodesApiService) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.nodeId = this.activatedRoute.snapshot.params['node-id'];
|
||||
this.nodeService.getNode(this.nodeId).subscribe((entry: MinimalNode) => {
|
||||
const node: MinimalNode = entry;
|
||||
this.nodeName = node.name;
|
||||
this.isFile = node.isFile;
|
||||
...
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
You can supply a number of extra options using the `options` parameter. See the
|
||||
[getNode](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodesApi.md#getNode)
|
||||
page in the Alfresco JS API docs for more information.
|
||||
|
||||
### Getting folder node contents
|
||||
|
||||
The `getNodeChildren` method returns the contents of a folder
|
||||
as a list of items. The
|
||||
[getNodeChildren](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodesApi.md#getNodeChildren)
|
||||
page in the Alfresco JS API gives more information about the structure of the
|
||||
`options` parameter.
|
||||
|
||||
### Creating and updating nodes
|
||||
|
||||
You can use the `createNode` and `createFolder` methods to add new nodes
|
||||
within a parent folder node, and the `updateNode` method to update an
|
||||
existing node. See the
|
||||
[addNode](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodesApi.md#addNode)
|
||||
and
|
||||
[updateNode](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodesApi.md#updateNode)
|
||||
entries in the Alfresco JS API for further information about the available options and
|
||||
the format of the new node data.
|
||||
|
||||
### Deleting and restoring nodes
|
||||
|
||||
The Content Services repository maintains a "trashcan" where items are
|
||||
temporarily held after they have been deleted. This means you can
|
||||
restore a deleted item if you remove it from the trashcan before it
|
||||
gets deleted permanently.
|
||||
|
||||
By default, the `deleteNode` method moves an item into the trash, where it can
|
||||
be retrieved using `restoreNode`. However, you can set an option for `deleteNode`
|
||||
to delete the node immediately if you have the right permissions. See the
|
||||
[deleteNode](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodesApi.md#deleteNode)
|
||||
and
|
||||
[restoreNode](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodesApi.md#restoreNode)
|
||||
pages in the Alfresco JS API for further details and options. Note that you can also use the
|
||||
[Deleted Nodes Api service](deleted-nodes-api.service.md) get a list of all items currently in the trashcan.
|
||||
|
||||
## See also
|
||||
|
||||
- [Deleted nodes api service](deleted-nodes-api.service.md)
|
||||
- [Document list component](../../content-services/document-list.component.md)
|
||||
- [Node service](node.service.md)
|
95
docs/core/services/notification.service.md
Normal file
95
docs/core/services/notification.service.md
Normal file
@@ -0,0 +1,95 @@
|
||||
---
|
||||
Title: Notification Service
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2018-06-08
|
||||
---
|
||||
|
||||
# [Notification Service](../../../lib/core/services/notification.service.ts "Defined in notification.service.ts")
|
||||
|
||||
Shows a notification message with optional feedback.
|
||||
|
||||

|
||||
|
||||
## Class members
|
||||
|
||||
### Methods
|
||||
|
||||
- **dismissSnackMessageAction**()<br/>
|
||||
dismiss the notification snackbar
|
||||
- **openSnackMessage**(message: `string`, config: `number|MatSnackBarConfig` = [`NotificationService`](../../core/services/notification.service.md)`.DEFAULT_DURATION_MESSAGE`): [`MatSnackBarRef`](https://material.angular.io/components/snack-bar/overview)`<any>`<br/>
|
||||
Opens a SnackBar notification to show a message.
|
||||
- _message:_ `string` - The message (or resource key) to show.
|
||||
- _config:_ `number|MatSnackBarConfig` - Time before notification disappears after being shown or MatSnackBarConfig object
|
||||
- **Returns** [`MatSnackBarRef`](https://material.angular.io/components/snack-bar/overview)`<any>` - Information/control object for the SnackBar
|
||||
- **openSnackMessageAction**(message: `string`, action: `string`, config: `number|MatSnackBarConfig` = [`NotificationService`](../../core/services/notification.service.md)`.DEFAULT_DURATION_MESSAGE`): [`MatSnackBarRef`](https://material.angular.io/components/snack-bar/overview)`<any>`<br/>
|
||||
Opens a SnackBar notification with a message and a response button.
|
||||
- _message:_ `string` - The message (or resource key) to show.
|
||||
- _action:_ `string` - Caption for the response button
|
||||
- _config:_ `number|MatSnackBarConfig` - Time before notification disappears after being shown or MatSnackBarConfig object
|
||||
- **Returns** [`MatSnackBarRef`](https://material.angular.io/components/snack-bar/overview)`<any>` - Information/control object for the SnackBar
|
||||
|
||||
## Details
|
||||
|
||||
The [Notification Service](notification.service.md) is implemented on top of the Angular Material Design snackbar.
|
||||
Use this service to show a notification message, and optionally get feedback from it.
|
||||
|
||||
```ts
|
||||
import { NotificationService } from '@alfresco/adf-core';
|
||||
|
||||
export class MyComponent implements OnInit {
|
||||
|
||||
constructor(private notificationService: NotificationService) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.notificationService
|
||||
.openSnackMessage('test', 200000)
|
||||
.afterDismissed()
|
||||
.subscribe(() => {
|
||||
console.log('The snack-bar was dismissed');
|
||||
});
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```ts
|
||||
import { NotificationService } from '@alfresco/adf-core';
|
||||
|
||||
export class MyComponent implements OnInit {
|
||||
|
||||
constructor(private notificationService: NotificationService) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.notificationService
|
||||
.openSnackMessageAction('Do you want to report this issue?', 'send', 200000)
|
||||
.afterDismissed()
|
||||
.subscribe(() => {
|
||||
console.log('The snack-bar was dismissed');
|
||||
});
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```ts
|
||||
import { NotificationService } from '@alfresco/adf-core';
|
||||
import { MatSnackBarConfig } from '@angular/material';
|
||||
|
||||
export class MyComponent implements OnInit {
|
||||
|
||||
snackBarConfig: MatSnackBarConfig = new MatSnackBarConfig();
|
||||
|
||||
constructor(private notificationService: NotificationService) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.notificationService
|
||||
.openSnackMessageAction('Do you want to report this issue?', 'send', snackBarConfig)
|
||||
.afterDismissed()
|
||||
.subscribe(() => {
|
||||
console.log('The snack-bar was dismissed');
|
||||
});
|
||||
}
|
||||
}
|
||||
```
|
31
docs/core/services/page-title.service.md
Normal file
31
docs/core/services/page-title.service.md
Normal file
@@ -0,0 +1,31 @@
|
||||
---
|
||||
Title: Page Title service
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2018-11-19
|
||||
---
|
||||
|
||||
# [Page Title service](../../../lib/core/services/page-title.service.ts "Defined in page-title.service.ts")
|
||||
|
||||
Sets the page title.
|
||||
|
||||
## Class members
|
||||
|
||||
### Methods
|
||||
|
||||
- **setTitle**(value: `string` = `""`)<br/>
|
||||
Sets the page title.
|
||||
- _value:_ `string` - The new title
|
||||
|
||||
## Details
|
||||
|
||||
If an application name is supplied in the app config file then this will
|
||||
be concatenated with the `value` parameter when `setTitle` is called, giving
|
||||
a result of the form "PageName - AppName" (see
|
||||
[App Config service](app-config.service.md) for more information). If `value`
|
||||
is not supplied then just the app name is used; this will default to
|
||||
"Alfresco ADF Application" when no app name set in the config file.
|
||||
|
||||
## See also
|
||||
|
||||
- [App config service](app-config.service.md)
|
38
docs/core/services/people-content.service.md
Normal file
38
docs/core/services/people-content.service.md
Normal file
@@ -0,0 +1,38 @@
|
||||
---
|
||||
Title: People Content service
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2018-04-06
|
||||
---
|
||||
|
||||
# [People Content service](../../../lib/core/services/people-content.service.ts "Defined in people-content.service.ts")
|
||||
|
||||
Gets information about a Content Services user.
|
||||
|
||||
## Class members
|
||||
|
||||
### Methods
|
||||
|
||||
- **getCurrentPerson**(): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
|
||||
Gets information about the user who is currently logged in.
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - User information
|
||||
- **getPerson**(personId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
|
||||
Gets information about a user identified by their username.
|
||||
- _personId:_ `string` - ID of the target user
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - User information
|
||||
|
||||
## Details
|
||||
|
||||
The class returned by `getPerson` and `getCurrentPerson` is detailed
|
||||
in the [Ecm User model docs](../models/ecm-user.model.md). The `avatarId` passed to
|
||||
`getUserProfileImage` is available as a field of the [`EcmUserModel`](../../core/models/ecm-user.model.md) instance
|
||||
returned for a particular person.
|
||||
|
||||
See the
|
||||
[getPerson](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/PeopleApi.md#getPerson)
|
||||
method in the Alfresco JS API for more information about the REST calls used by this service.
|
||||
|
||||
## See also
|
||||
|
||||
- [People process service](people-process.service.md)
|
||||
- [Ecm user model](../models/ecm-user.model.md)
|
58
docs/core/services/people-process.service.md
Normal file
58
docs/core/services/people-process.service.md
Normal file
@@ -0,0 +1,58 @@
|
||||
---
|
||||
Title: People Process service
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2018-04-05
|
||||
---
|
||||
|
||||
# [People Process service](../../../lib/core/services/people-process.service.ts "Defined in people-process.service.ts")
|
||||
|
||||
Gets information about Process Services users.
|
||||
|
||||
## Class members
|
||||
|
||||
### Methods
|
||||
|
||||
- **getUserImage**(user: [`UserProcessModel`](../../core/models/user-process.model.md)): `string`<br/>
|
||||
Gets the profile picture URL for the specified user.
|
||||
- _user:_ [`UserProcessModel`](../../core/models/user-process.model.md) - The target user
|
||||
- **Returns** `string` - Profile picture URL
|
||||
- **getWorkflowUsers**(taskId?: `string`, searchWord?: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`UserProcessModel`](../../core/models/user-process.model.md)`[]>`<br/>
|
||||
Gets information about users across all tasks.
|
||||
- _taskId:_ `string` - (Optional) ID of the task
|
||||
- _searchWord:_ `string` - (Optional) Filter text to search for
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`UserProcessModel`](../../core/models/user-process.model.md)`[]>` - Array of user information objects
|
||||
- **involveUserWithTask**(taskId: `string`, idToInvolve: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`UserProcessModel`](../../core/models/user-process.model.md)`[]>`<br/>
|
||||
Sets a user to be involved with a task.
|
||||
- _taskId:_ `string` - ID of the target task
|
||||
- _idToInvolve:_ `string` - ID of the user to involve
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`UserProcessModel`](../../core/models/user-process.model.md)`[]>` - Empty response when the update completes
|
||||
- **removeInvolvedUser**(taskId: `string`, idToRemove: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`UserProcessModel`](../../core/models/user-process.model.md)`[]>`<br/>
|
||||
Removes a user who is currently involved with a task.
|
||||
- _taskId:_ `string` - ID of the target task
|
||||
- _idToRemove:_ `string` - ID of the user to remove
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`UserProcessModel`](../../core/models/user-process.model.md)`[]>` - Empty response when the update completes
|
||||
|
||||
## Details
|
||||
|
||||
Use `getWorkflowUsers` to find users across all tasks, optionally filtering by the `searchWord`
|
||||
in the task name. The `taskId` parameter, if used, specifies a task to be _excluded_ from the
|
||||
results. You would typically use this feature to find new users to assign to a task, in which
|
||||
case you would want to exclude users already assigned to that task.
|
||||
|
||||
The [User Process model](../models/user-process.model.md) class used by the methods is seen throughout
|
||||
ADF's Process Services features. Note that for `involveUserWithTask` and `removeInvolvedUser`,
|
||||
null data is returned rather than usable details about users.
|
||||
|
||||
You can find more information about the REST API methods used by this service in the
|
||||
[Task Actions API](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-activiti-rest-api/docs/TaskActionsApi.md#involveUser)
|
||||
(for `involveUserWithTask` and `removeInvolvedUser`), the
|
||||
[User Workflow API](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-activiti-rest-api/docs/UsersWorkflowApi.md#getUsers)
|
||||
(for `getWorkflowUsers`) and the
|
||||
[User API](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-activiti-rest-api/docs/UserApi.md#getuserprofilepictureurl)(for `getUserImage`).
|
||||
|
||||
## See also
|
||||
|
||||
- [User process model](../models/user-process.model.md)
|
||||
- [Bpm user model](../models/bpm-user.model.md)
|
||||
- [People content service](people-content.service.md)
|
392
docs/core/services/process-content.service.md
Normal file
392
docs/core/services/process-content.service.md
Normal file
@@ -0,0 +1,392 @@
|
||||
---
|
||||
Title: Process Content Service
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
---
|
||||
|
||||
# [Process Content Service](../../../lib/core/form/services/process-content.service.ts "Defined in process-content.service.ts")
|
||||
|
||||
Manipulates content related to a Process Instance or Task Instance in APS.
|
||||
|
||||
## Class members
|
||||
|
||||
### Methods
|
||||
|
||||
- **createProcessRelatedContent**(processInstanceId: `string`, content: `any`, opts?: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
|
||||
Associates an uploaded file with a process instance.
|
||||
- _processInstanceId:_ `string` - ID of the target process instance
|
||||
- _content:_ `any` - File to associate
|
||||
- _opts:_ `any` - (Optional) Options supported by JS-API
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - Details of created content
|
||||
- **createTaskRelatedContent**(taskId: `string`, file: `any`, opts?: `any`): `any`<br/>
|
||||
Associates an uploaded file with a task instance.
|
||||
- _taskId:_ `string` - ID of the target task
|
||||
- _file:_ `any` - File to associate
|
||||
- _opts:_ `any` - (Optional) Options supported by JS-API
|
||||
- **Returns** `any` - Details of created content
|
||||
- **createTemporaryRawRelatedContent**(file: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`RelatedContentRepresentation`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-activiti-rest-api/docs/RelatedContentRepresentation.md)`>`<br/>
|
||||
Create temporary related content from an uploaded file.
|
||||
- _file:_ `any` - File to use for content
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`RelatedContentRepresentation`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-activiti-rest-api/docs/RelatedContentRepresentation.md)`>` - The created content data
|
||||
- **deleteRelatedContent**(contentId: `number`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
|
||||
Deletes related content.
|
||||
- _contentId:_ `number` - Identifier of the content to delete
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - Null response that notifies when the deletion is complete
|
||||
- **getContentPreview**(contentId: `number`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob)`>`<br/>
|
||||
Gets the preview for a related content file.
|
||||
- _contentId:_ `number` - ID of the related content
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob)`>` - Binary data of the content preview
|
||||
- **getContentThumbnail**(contentId: `number`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob)`>`<br/>
|
||||
Gets the thumbnail for a related content file.
|
||||
- _contentId:_ `number` - ID of the related content
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob)`>` - Binary data of the thumbnail image
|
||||
- **getFileContent**(contentId: `number`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`RelatedContentRepresentation`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-activiti-rest-api/docs/RelatedContentRepresentation.md)`>`<br/>
|
||||
Gets the metadata for a related content item.
|
||||
- _contentId:_ `number` - ID of the content item
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`RelatedContentRepresentation`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-activiti-rest-api/docs/RelatedContentRepresentation.md)`>` - Metadata for the content
|
||||
- **getFileRawContent**(contentId: `number`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob)`>`<br/>
|
||||
Gets raw binary content data for a related content file.
|
||||
- _contentId:_ `number` - ID of the related content
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob)`>` - Binary data of the related content
|
||||
- **getFileRawContentUrl**(contentId: `number`): `string`<br/>
|
||||
Gets a URL for direct access to a related content file.
|
||||
- _contentId:_ `number` - ID of the related content
|
||||
- **Returns** `string` - URL to access the content
|
||||
- **getProcessRelatedContent**(processId: `string`, opts?: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
|
||||
Gets related content items for a process instance.
|
||||
- _processId:_ `string` - ID of the target process
|
||||
- _opts:_ `any` - (Optional) Options supported by JS-API
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - Metadata for the content
|
||||
- **getTaskRelatedContent**(taskId: `string`, opts?: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
|
||||
Gets related content items for a task instance.
|
||||
- _taskId:_ `string` - ID of the target task
|
||||
- _opts:_ `any` - (Optional) Options supported by JS-API
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - Metadata for the content
|
||||
- **handleError**(error: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
|
||||
Reports an error message.
|
||||
- _error:_ `any` - Data object with optional `message` and `status` fields for the error
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - Callback when an error occurs
|
||||
- **toJson**(res: `any`): `any`<br/>
|
||||
Creates a JSON representation of data.
|
||||
- _res:_ `any` - Object representing data
|
||||
- **Returns** `any` - JSON object
|
||||
- **toJsonArray**(res: `any`): `any`<br/>
|
||||
Creates a JSON array representation of data.
|
||||
- _res:_ `any` - Object representing data
|
||||
- **Returns** `any` - JSON array object
|
||||
|
||||
## Methods
|
||||
|
||||
#### createProcessRelatedContent(processInstanceId: string, content: any, opts?: any): Observable`<any>`
|
||||
|
||||
Associate an uploaded file with a Process Instance.
|
||||
|
||||
Let's say we have an upload button as follows:
|
||||
|
||||
```html
|
||||
<div class="button-row">
|
||||
<button mat-button color="accent" mat-mini-fab (click)="fileInput.click()">
|
||||
<mat-icon>attachment</mat-icon>
|
||||
</button>
|
||||
<input hidden type="file" #fileInput (change)="onUploadFile($event)"/>
|
||||
</div>
|
||||
```
|
||||
|
||||
We can then create related content as follows:
|
||||
|
||||
```ts
|
||||
export class SomePageComponent implements OnInit {
|
||||
|
||||
@ViewChild('fileInput') fileInput;
|
||||
|
||||
...
|
||||
|
||||
onUploadFile() {
|
||||
const fileBrowser = this.fileInput.nativeElement;
|
||||
if (fileBrowser.files && fileBrowser.files[0]) {
|
||||
const file: File = fileBrowser.files[0];
|
||||
const processInstanceId = '11337';
|
||||
const opts = {
|
||||
isRelatedContent: true
|
||||
};
|
||||
this.contentService.createProcessRelatedContent(processInstanceId, file, opts).subscribe(
|
||||
(relContent: RelatedContentRepresentation) => {
|
||||
console.log('Related content: ', relContent);
|
||||
}, error => {
|
||||
console.log('Error: ', error);
|
||||
});
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
In the above sample code the `file` is uploaded via an HTML input element.
|
||||
The `processInstanceId` refers to a process instance ID for a running process in APS.
|
||||
The returned `relContent` object looks like in this sample:
|
||||
|
||||
Related content:
|
||||
contentAvailable: true
|
||||
created: Wed Nov 08 2017 10:50:30 GMT+0000 (GMT) {}
|
||||
createdBy: {id: 1, firstName: null, lastName: "Administrator", email: "admin@app.activiti.com"}
|
||||
id: 6007
|
||||
link: false
|
||||
mimeType: "application/pdf"
|
||||
name: "simple.pdf"
|
||||
previewStatus: "queued"
|
||||
relatedContent: true
|
||||
simpleType: "pdf"
|
||||
thumbnailStatus: "queued"
|
||||
|
||||
The related content `id` can be used by other methods in this service to get to the content and to
|
||||
delete it. It is referred to as the `contentId`.
|
||||
|
||||
If you look at attachments for the process instance it should now display the new file.
|
||||
|
||||
#### createTaskRelatedContent(taskId: string, file: any, opts?: any)
|
||||
|
||||
Associate an uploaded file with a Task Instance. This is in effect very similar
|
||||
to the `createProcessRelatedContent` call. Just use `taskInstanceId` instead of `processInstanceId`.
|
||||
|
||||
```ts
|
||||
onUploadFile() {
|
||||
const fileBrowser = this.fileInput.nativeElement;
|
||||
if (fileBrowser.files && fileBrowser.files[0]) {
|
||||
const file: File = fileBrowser.files[0];
|
||||
const taskInstanceId = '15303';
|
||||
const opts = {
|
||||
isRelatedContent: true
|
||||
};
|
||||
this.contentService.createTaskRelatedContent(taskInstanceId, file, opts).subscribe(
|
||||
(relContent: RelatedContentRepresentation) => {
|
||||
console.log('Related content: ', relContent);
|
||||
}, error => {
|
||||
console.log('Error: ', error);
|
||||
});
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
For more information see the docs for `createProcessRelatedContent`.
|
||||
|
||||
#### createTemporaryRawRelatedContent(file: any): Observable`<RelatedContentRepresentation>`
|
||||
|
||||
Create temporary related content from an uploaded file. This means that the related content
|
||||
is not yet associated with a process instance or a task instance.
|
||||
|
||||
```ts
|
||||
onUploadFile() {
|
||||
const fileBrowser = this.fileInput.nativeElement;
|
||||
if (fileBrowser.files && fileBrowser.files[0]) {
|
||||
const file: File = fileBrowser.files[0];
|
||||
this.contentService.createTemporaryRawRelatedContent(file).subscribe(
|
||||
(relContent: RelatedContentRepresentation) => {
|
||||
console.log('Related content: ', relContent);
|
||||
}, error => {
|
||||
console.log('Error: ', error);
|
||||
});
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
For more information see the docs for `createProcessRelatedContent`.
|
||||
|
||||
#### deleteRelatedContent(contentId: number): Observable`<any>`
|
||||
|
||||
Delete related content via the content identifier:
|
||||
|
||||
```ts
|
||||
const contentId = 6008;
|
||||
this.contentService.deleteRelatedContent(contentId).subscribe(
|
||||
res => {
|
||||
console.log('Delete response: ', res);
|
||||
}, error => {
|
||||
console.log('Error: ', error);
|
||||
});
|
||||
```
|
||||
|
||||
The response is going to be `null` if the delete was successful.
|
||||
|
||||
See `getProcessRelatedContent` and `getTaskRelatedContent` for how to get to the `contentId`.
|
||||
|
||||
#### getFileContent(contentId: number): Observable`<RelatedContentRepresentation>`
|
||||
|
||||
Get the metadata for a related content item in the format of a [`RelatedContentRepresentation`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-activiti-rest-api/docs/RelatedContentRepresentation.md) object:
|
||||
|
||||
```ts
|
||||
const contentId = 6008;
|
||||
this.contentService.getFileContent(contentId).subscribe(
|
||||
res => {
|
||||
console.log('Response Metadata: ', res);
|
||||
}, error => {
|
||||
console.log('Error: ', error);
|
||||
});
|
||||
```
|
||||
|
||||
The metadata response looks like in this example:
|
||||
|
||||
contentAvailable: true
|
||||
created: Wed Nov 08 2017 11:26:14 GMT+0000 (GMT) {}
|
||||
createdBy: {id: 1, firstName: null, lastName: "Administrator", email: "admin@app.activiti.com"}
|
||||
id: 6008
|
||||
link: false
|
||||
mimeType: "application/pdf"
|
||||
name: "simple.pdf"
|
||||
previewStatus: "created"
|
||||
relatedContent: true
|
||||
simpleType: "pdf"
|
||||
thumbnailStatus: "created"
|
||||
|
||||
See `getProcessRelatedContent` and `getTaskRelatedContent` for how to get to the `contentId`.
|
||||
|
||||
#### getFileRawContentUrl(contentId: number): string
|
||||
|
||||
Get the URL for direct access to a related content file:
|
||||
|
||||
```ts
|
||||
const contentId = 6008;
|
||||
const url = this.contentService.getFileRawContentUrl(contentId);
|
||||
console.log('URL: ', url);
|
||||
```
|
||||
|
||||
The URL response looks something like this:
|
||||
|
||||
`http://localhost:4200/bpm/activiti-app/api/enterprise/content/6008/raw`
|
||||
|
||||
This URL can be used to directly access the content file, such as from a browser.
|
||||
|
||||
See `getProcessRelatedContent` and `getTaskRelatedContent` for how to get to the `contentId`.
|
||||
|
||||
#### getFileRawContent(contentId: number): Observable`<Blob>`
|
||||
|
||||
Get the raw content bytes as a BLOB for a related content file:
|
||||
|
||||
```ts
|
||||
const contentId = 5006;
|
||||
this.contentService.getFileRawContent(contentId).subscribe(
|
||||
res => {
|
||||
console.log('Response BLOB: ', res);
|
||||
}, error => {
|
||||
console.log('Error: ', error);
|
||||
});
|
||||
```
|
||||
|
||||
The BLOB response looks something like this:
|
||||
|
||||
`Blob(205824) {size: 205824, type: "application/msword"}`
|
||||
|
||||
See `getProcessRelatedContent` and `getTaskRelatedContent` for how to get to the `contentId`.
|
||||
|
||||
#### getContentPreview(contentId: number): Observable`<Blob>`
|
||||
|
||||
Get the preview file for a related content file. A content file might be for example a
|
||||
MS Word document. This method would give you the PDF preview for this document,
|
||||
if it has been generated:
|
||||
|
||||
```ts
|
||||
const contentId = 5006;
|
||||
this.contentService.getContentPreview(contentId).subscribe(
|
||||
res => {
|
||||
console.log('Response Preview BLOB: ', res);
|
||||
}, error => {
|
||||
console.log('Error: ', error);
|
||||
});
|
||||
```
|
||||
|
||||
The preview BLOB response looks something like this:
|
||||
|
||||
`Blob(44101) {size: 44101, type: "application/pdf"}`
|
||||
|
||||
See `getProcessRelatedContent` and `getTaskRelatedContent` for how to get to the `contentId`.
|
||||
|
||||
#### getContentThumbnail(contentId: number): Observable`<Blob>`
|
||||
|
||||
Get the thumbnail file for a related content file. A content file might be for example a
|
||||
MS Word document. This method would give you the image thumbnail for this document,
|
||||
if it has been generated:
|
||||
|
||||
```ts
|
||||
const contentId = 5006;
|
||||
this.contentService.getContentThumbnail(contentId).subscribe(
|
||||
res => {
|
||||
console.log('Response thumbnail BLOB: ', res);
|
||||
}, error => {
|
||||
console.log('Error: ', error);
|
||||
});
|
||||
```
|
||||
|
||||
The response looks like in this sample:
|
||||
|
||||
`Blob(13780) {size: 13780, type: "image/png"}`
|
||||
|
||||
See `getProcessRelatedContent` and `getTaskRelatedContent` for how to get to the `contentId`.
|
||||
|
||||
#### getProcessRelatedContent(processId: string): Observable`<any>`
|
||||
|
||||
Get related content items for passed in Process Instance ID, only metadata for related content is returned:
|
||||
|
||||
```ts
|
||||
const processId = '11337';
|
||||
this.contentService.getProcessRelatedContent(processId).subscribe(
|
||||
res => {
|
||||
console.log('Response: ', res);
|
||||
}, error => {
|
||||
console.log('Error: ', error);
|
||||
});
|
||||
```
|
||||
|
||||
The response looks like in the following sample:
|
||||
|
||||
size: 2
|
||||
start:0
|
||||
total:2
|
||||
data:
|
||||
0:
|
||||
contentAvailable: true
|
||||
created: "2017-10-29T07:28:15.546+0000"
|
||||
createdBy: {id: 1, firstName: null, lastName: "Administrator", email: "admin@app.activiti.com"}
|
||||
id: 5006
|
||||
link: false
|
||||
mimeType: "application/msword"
|
||||
name: "More info for Invoice.doc"
|
||||
previewStatus: "created"
|
||||
relatedContent: true
|
||||
simpleType: "word"
|
||||
thumbnailStatus: "created"
|
||||
1:
|
||||
id: 6008,
|
||||
name: "simple.pdf",
|
||||
created: "2017-11-08T11:26:14.162+0000",
|
||||
createdBy: {…},
|
||||
relatedContent: true,
|
||||
…}
|
||||
|
||||
The `id` property corresponds to the `contentId` property used in many of the other methods of this service.
|
||||
|
||||
#### getTaskRelatedContent(taskId: string): Observable`<any>`
|
||||
|
||||
Get related content items for passed in Task Instance ID, only metadata for related content is returned:
|
||||
|
||||
```ts
|
||||
const taskId = '15303';
|
||||
this.contentService.getTaskRelatedContent(taskId).subscribe(
|
||||
res => {
|
||||
console.log('Response: ', res);
|
||||
}, error => {
|
||||
console.log('Error: ', error);
|
||||
});
|
||||
```
|
||||
|
||||
The response format is the same as for the `getProcessRelatedContent` method, see its docs.
|
||||
|
||||
## Details
|
||||
|
||||
## Importing
|
||||
|
||||
```ts
|
||||
import { RelatedContentRepresentation } from '@alfresco/js-api';
|
||||
import { ProcessContentService } from '@alfresco/adf-core';
|
||||
|
||||
export class SomePageComponent implements OnInit {
|
||||
|
||||
constructor(private contentService: ProcessContentService) {
|
||||
}
|
||||
```
|
79
docs/core/services/renditions.service.md
Normal file
79
docs/core/services/renditions.service.md
Normal file
@@ -0,0 +1,79 @@
|
||||
---
|
||||
Title: Renditions service
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2019-01-23
|
||||
---
|
||||
|
||||
# [Renditions service](../../../lib/core/services/renditions.service.ts "Defined in renditions.service.ts")
|
||||
|
||||
Manages prearranged conversions of content to different formats.
|
||||
|
||||
## Class members
|
||||
|
||||
### Methods
|
||||
|
||||
- **convert**(nodeId: `string`, encoding: `string`, pollingInterval: `number` = `1000`, retries: `number` = `5`): [`Observable`](http://reactivex.io/documentation/observable.html)`<Object>`<br/>
|
||||
Repeatedly attempts to create a rendition, through to success or failure.
|
||||
- _nodeId:_ `string` - ID of the target node
|
||||
- _encoding:_ `string` - Name of the rendition encoding
|
||||
- _pollingInterval:_ `number` - Time interval (in milliseconds) between checks for completion
|
||||
- _retries:_ `number` - Number of attempts to make before declaring failure
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<Object>` - True if the rendition was created, false otherwise
|
||||
- **createRendition**(nodeId: `string`, encoding: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<__type>`<br/>
|
||||
Creates a rendition for a node.
|
||||
- _nodeId:_ `string` - ID of the target node
|
||||
- _encoding:_ `string` - Name of the rendition encoding
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<__type>` - Null response to indicate completion
|
||||
- **generateRenditionForNode**(nodeId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
|
||||
Generates a rendition for a node using the first available encoding.
|
||||
- _nodeId:_ `string` - ID of the target node
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - Null response to indicate completion
|
||||
- **getAvailableRenditionForNode**(nodeId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`RenditionEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/RenditionEntry.md)`>`<br/>
|
||||
Gets the first available rendition found for a node.
|
||||
- _nodeId:_ `string` - ID of the target node
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`RenditionEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/RenditionEntry.md)`>` - Information object for the rendition
|
||||
- **getRendition**(nodeId: `string`, encoding: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`RenditionEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/RenditionEntry.md)`>`<br/>
|
||||
Gets information about a rendition of a node.
|
||||
- _nodeId:_ `string` - ID of the target node
|
||||
- _encoding:_ `string` - Name of the rendition encoding
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`RenditionEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/RenditionEntry.md)`>` - Information object about the rendition
|
||||
- **getRenditionUrl**(nodeId: `string`, encoding: `string`): `string`<br/>
|
||||
Gets a URL linking to the specified rendition of a node.
|
||||
- _nodeId:_ `string` - ID of the target node
|
||||
- _encoding:_ `string` - Name of the rendition encoding
|
||||
- **Returns** `string` - URL string
|
||||
- **getRenditionsListByNodeId**(nodeId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`RenditionPaging`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/RenditionPaging.md)`>`<br/>
|
||||
Gets a list of all renditions for a node.
|
||||
- _nodeId:_ `string` - ID of the target node
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`RenditionPaging`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/RenditionPaging.md)`>` - Paged list of rendition details
|
||||
- **isConversionPossible**(nodeId: `string`, encoding: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<boolean>`<br/>
|
||||
Checks if the node can be converted using the specified rendition.
|
||||
- _nodeId:_ `string` - ID of the target node
|
||||
- _encoding:_ `string` - Name of the rendition encoding
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<boolean>` - True if the node can be converted, false otherwise
|
||||
- **isRenditionAvailable**(nodeId: `string`, encoding: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<boolean>`<br/>
|
||||
Checks if the specified rendition is available for a node.
|
||||
- _nodeId:_ `string` - ID of the target node
|
||||
- _encoding:_ `string` - Name of the rendition encoding
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<boolean>` - True if the rendition is available, false otherwise
|
||||
|
||||
## Details
|
||||
|
||||
ACS allows content items to be converted to other formats for display or delivery.
|
||||
For example, a raw text file might be converted to HTML to enable better formatting
|
||||
in a web browser or a PDF might be converted to an equivalent bitmap image. A
|
||||
_rendition_ is a prearranged conversion that is set up for an item for convenient
|
||||
repeated use. More information about renditions is available in the
|
||||
[Content Services documentation](https://docs.alfresco.com/5.2/references/dev-extension-points-content-transformer.html).
|
||||
|
||||
In the [Renditions service](renditions.service.md) methods, the `nodeId` is a string identifying the content
|
||||
node that the rendition applies to. This can be obtained from
|
||||
[Document List component](../../content-services/document-list.component.md) events and various other places
|
||||
in the ADF API. The `encoding` identifies the conversion performed by the rendition.
|
||||
|
||||
See the
|
||||
[Renditions API page](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/RenditionsApi.md#createRendition)
|
||||
in the Alfresco JS API for more information about the
|
||||
[`RenditionPaging`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/RenditionPaging.md)
|
||||
class and other implementation details.
|
39
docs/core/services/search-configuration.service.md
Normal file
39
docs/core/services/search-configuration.service.md
Normal file
@@ -0,0 +1,39 @@
|
||||
---
|
||||
Title: Search Configuration service
|
||||
Added: v2.1.0
|
||||
Status: Active
|
||||
Last reviewed: 2018-09-13
|
||||
---
|
||||
|
||||
# [Search Configuration service](../../../lib/core/services/search-configuration.service.ts "Defined in search-configuration.service.ts")
|
||||
|
||||
Provides fine control of parameters to a search.
|
||||
|
||||
## Class members
|
||||
|
||||
### Methods
|
||||
|
||||
- **generateQueryBody**(searchTerm: `string`, maxResults: `number`, skipCount: `number`): `QueryBody`<br/>
|
||||
Generates a QueryBody object with custom search parameters.
|
||||
- _searchTerm:_ `string` - Term text to search for
|
||||
- _maxResults:_ `number` - Maximum number of search results to show in a page
|
||||
- _skipCount:_ `number` - The offset of the start of the page within the results list
|
||||
- **Returns** `QueryBody` - Query body defined by the parameters
|
||||
|
||||
## Details
|
||||
|
||||
The `generateQueryBody` method returns a
|
||||
[QueryBody](https://github.com/Alfresco/alfresco-js-api/blob/1.6.0/src/alfresco-search-rest-api/docs/QueryBody.md)
|
||||
object. This configures the search to use `searchTerm` along with `maxResults` and `skipCount`
|
||||
specified for the paging of the search results.
|
||||
|
||||
This service is a standard implementation of the
|
||||
[Search configuration interface](../interfaces/search-configuration.interface.md) that works well for many
|
||||
common cases. However, you can also supply your own implementation if you need to. See the
|
||||
[Search configuration interface](../interfaces/search-configuration.interface.md) page for full details and
|
||||
example code.
|
||||
|
||||
## See also
|
||||
|
||||
- [Search component](../../content-services/search.component.md)
|
||||
- [Search configuration interface](../interfaces/search-configuration.interface.md)
|
44
docs/core/services/search.service.md
Normal file
44
docs/core/services/search.service.md
Normal file
@@ -0,0 +1,44 @@
|
||||
---
|
||||
Title: Search service
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2018-12-03
|
||||
---
|
||||
|
||||
# [Search service](../../../lib/core/services/search.service.ts "Defined in search.service.ts")
|
||||
|
||||
Accesses the Content Services Search API.
|
||||
|
||||
## Class members
|
||||
|
||||
### Methods
|
||||
|
||||
- **getNodeQueryResults**(term: `string`, options?: [`SearchOptions`](../../../lib/core/services/search.service.ts)): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`NodePaging`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/NodePaging.md)`>`<br/>
|
||||
Gets a list of nodes that match the given search criteria.
|
||||
- _term:_ `string` - Term to search for
|
||||
- _options:_ [`SearchOptions`](../../../lib/core/services/search.service.ts) - (Optional) Options for delivery of the search results
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`NodePaging`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/NodePaging.md)`>` - List of nodes resulting from the search
|
||||
- **search**(searchTerm: `string`, maxResults: `number`, skipCount: `number`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`NodePaging`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/NodePaging.md)`>`<br/>
|
||||
Performs a search.
|
||||
- _searchTerm:_ `string` - Term to search for
|
||||
- _maxResults:_ `number` - Maximum number of items in the list of results
|
||||
- _skipCount:_ `number` - Number of higher-ranked items to skip over in the list
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`NodePaging`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/NodePaging.md)`>` - List of search results
|
||||
- **searchByQueryBody**(queryBody: `QueryBody`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`NodePaging`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/NodePaging.md)`>`<br/>
|
||||
Performs a search with its parameters supplied by a QueryBody object.
|
||||
- _queryBody:_ `QueryBody` - Object containing the search parameters
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`NodePaging`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/NodePaging.md)`>` - List of search results
|
||||
|
||||
## Details
|
||||
|
||||
See the
|
||||
[search method](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-search-rest-api/docs/SearchApi.md#search)
|
||||
in the Alfresco JS-API for the format of the query and returned data.
|
||||
The [Search Configuration service](../services/search-configuration.service.md)
|
||||
has a method to generate the QueryBody object used by `searchByQueryBody`. The properties of the
|
||||
[`SearchOptions`](../../../lib/core/services/search.service.ts)
|
||||
interface are documented in source file comments.
|
||||
|
||||
## See also
|
||||
|
||||
- [Search Configuration service](../services/search-configuration.service.md)
|
40
docs/core/services/shared-links-api.service.md
Normal file
40
docs/core/services/shared-links-api.service.md
Normal file
@@ -0,0 +1,40 @@
|
||||
---
|
||||
Title: Shared Links Api service
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2018-06-08
|
||||
---
|
||||
|
||||
# [Shared Links Api service](../../../lib/core/services/shared-links-api.service.ts "Defined in shared-links-api.service.ts")
|
||||
|
||||
Finds shared links to Content Services items.
|
||||
|
||||
## Class members
|
||||
|
||||
### Methods
|
||||
|
||||
- **createSharedLinks**(nodeId: `string`, options: `any` = `{}`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SharedLinkEntry`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/SharedLinkEntry.md)`>`<br/>
|
||||
Creates a shared link available to the current user.
|
||||
- _nodeId:_ `string` - ID of the node to link to
|
||||
- _options:_ `any` - Options supported by JS-API
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SharedLinkEntry`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/SharedLinkEntry.md)`>` - The shared link just created
|
||||
- **deleteSharedLink**(sharedId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SharedLinkEntry`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/SharedLinkEntry.md)`>`<br/>
|
||||
Deletes a shared link.
|
||||
- _sharedId:_ `string` - ID of the link to delete
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SharedLinkEntry`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/SharedLinkEntry.md)`>` - Null response notifying when the operation is complete
|
||||
- **getSharedLinks**(options: `any` = `{}`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`NodePaging`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/NodePaging.md)`>`<br/>
|
||||
Gets shared links available to the current user.
|
||||
- _options:_ `any` - Options supported by JS-API
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`NodePaging`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/NodePaging.md)`>` - List of shared links
|
||||
|
||||
## Details
|
||||
|
||||
Content Services allows users to generate URLs that can be shared with
|
||||
other people, even if they don't have a Content Services account. These
|
||||
URLs are known as _shared links_.
|
||||
|
||||
Use `getSharedLinks` to find all the shared links that are available to
|
||||
the current user. You can supply a number of `options` to refine the
|
||||
search; see the
|
||||
[Alfresco JS API](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/SharedlinksApi.md#findsharedlinks)
|
||||
for more information.
|
59
docs/core/services/sites.service.md
Normal file
59
docs/core/services/sites.service.md
Normal file
@@ -0,0 +1,59 @@
|
||||
---
|
||||
Title: Sites service
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2018-11-13
|
||||
---
|
||||
|
||||
# [Sites service](../../../lib/core/services/sites.service.ts "Defined in sites.service.ts")
|
||||
|
||||
Accesses and manipulates sites from a Content Services repository.
|
||||
|
||||
## Class members
|
||||
|
||||
### Methods
|
||||
|
||||
- **deleteSite**(siteId: `string`, permanentFlag: `boolean` = `true`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
|
||||
Deletes a site.
|
||||
- _siteId:_ `string` - Site to delete
|
||||
- _permanentFlag:_ `boolean` - True: deletion is permanent; False: site is moved to the trash
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - Null response notifying when the operation is complete
|
||||
- **getEcmCurrentLoggedUserName**(): `string`<br/>
|
||||
Gets the username of the user currently logged into ACS.
|
||||
- **Returns** `string` - Username string
|
||||
- **getSite**(siteId: `string`, opts?: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/SiteEntry.md)`|__type>`<br/>
|
||||
Gets the details for a site.
|
||||
- _siteId:_ `string` - ID of the target site
|
||||
- _opts:_ `any` - (Optional) Options supported by JS-API
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/SiteEntry.md)`|__type>` - Information about the site
|
||||
- **getSiteContent**(siteId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/SiteEntry.md)`|__type>`<br/>
|
||||
Gets a site's content.
|
||||
- _siteId:_ `string` - ID of the target site
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/SiteEntry.md)`|__type>` - Site content
|
||||
- **getSiteMembers**(siteId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/SiteEntry.md)`|__type>`<br/>
|
||||
Gets a list of all a site's members.
|
||||
- _siteId:_ `string` - ID of the target site
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/SiteEntry.md)`|__type>` - Site members
|
||||
- **getSites**(opts: `any` = `{}`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SitePaging`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/SitePaging.md)`>`<br/>
|
||||
Gets a list of all sites in the repository.
|
||||
- _opts:_ `any` - Options supported by JS-API
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SitePaging`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/SitePaging.md)`>` - List of sites
|
||||
|
||||
## Details
|
||||
|
||||
You can use `getSites` to get a list of all sites in the repository.
|
||||
If you are only interested in a single site and you have its ID, you
|
||||
can use `getSite` to access it. Alternatively, you can use `getSiteContent`
|
||||
or `getSiteMembers` to extract just the `contents` and `members` properties
|
||||
of the site.
|
||||
|
||||
You can also delete a site using `deleteSite`. If the `permanentFlag` parameter
|
||||
is set to false then the site will be moved to the trash rather than being
|
||||
deleted immediately.
|
||||
|
||||
Both `getSite` and `getSites` have an `opts` parameter to supply extra
|
||||
options. See the Alfresco JS API docs about
|
||||
[getSites](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/SitesApi.md#getSites)
|
||||
and
|
||||
[getSite](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/SitesApi.md#getSite)
|
||||
for more information about the available options.
|
50
docs/core/services/storage.service.md
Normal file
50
docs/core/services/storage.service.md
Normal file
@@ -0,0 +1,50 @@
|
||||
---
|
||||
Title: Storage service
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2018-11-14
|
||||
---
|
||||
|
||||
# [Storage service](../../../lib/core/services/storage.service.ts "Defined in storage.service.ts")
|
||||
|
||||
Stores items in the form of key-value pairs.
|
||||
|
||||
## Class members
|
||||
|
||||
### Methods
|
||||
|
||||
- **clear**()<br/>
|
||||
Removes all currently stored items.
|
||||
- **getItem**(key: `string`): `string|null`<br/>
|
||||
Gets an item.
|
||||
- _key:_ `string` - Key to identify the item
|
||||
- **Returns** `string|null` - The item (if any) retrieved by the key
|
||||
- **hasItem**(key: `string`): `boolean`<br/>
|
||||
Is any item currently stored under `key`?
|
||||
- _key:_ `string` - Key identifying item to check
|
||||
- **Returns** `boolean` - True if key retrieves an item, false otherwise
|
||||
- **removeItem**(key: `string`)<br/>
|
||||
Removes a single item.
|
||||
- _key:_ `string` - Key to identify the item
|
||||
- **setItem**(key: `string`, data: `string`)<br/>
|
||||
Stores an item
|
||||
- _key:_ `string` - Key to identify the item
|
||||
- _data:_ `string` - Data to store
|
||||
|
||||
## Details
|
||||
|
||||
The service will check to see if
|
||||
[web storage](https://developer.mozilla.org/en-US/docs/Web/API/Storage/LocalStorage)
|
||||
is available on the browser. If it is available then the service will use it to
|
||||
store the key-value items persistently. Web storage can be used in a similar way to
|
||||
[cookies](cookie.service.md) but with a much higher size limit (several MB for
|
||||
web storage compared to a few KB for cookies). However, cookies are
|
||||
more widely supported by browsers and can be set to expire after a certain date.
|
||||
|
||||
If local storage is not available then non-persistent memory storage within the app is
|
||||
used instead.
|
||||
|
||||
## See also
|
||||
|
||||
- [Cookie service](cookie.service.md)
|
||||
- [Content service](content.service.md)
|
72
docs/core/services/thumbnail.service.md
Normal file
72
docs/core/services/thumbnail.service.md
Normal file
@@ -0,0 +1,72 @@
|
||||
---
|
||||
Title: Thumbnail service
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2018-11-13
|
||||
---
|
||||
|
||||
# [Thumbnail service](../../../lib/core/services/thumbnail.service.ts "Defined in thumbnail.service.ts")
|
||||
|
||||
Retrieves an SVG thumbnail image to represent a document type.
|
||||
|
||||
## Class members
|
||||
|
||||
### Methods
|
||||
|
||||
- **getDefaultMimeTypeIcon**(): `string`<br/>
|
||||
Gets a "miscellaneous" thumbnail URL for types with no other icon defined.
|
||||
- **Returns** `string` - URL string
|
||||
- **getDocumentThumbnailUrl**(node: `any`): `string`<br/>
|
||||
Gets a thumbnail URL for the given document node.
|
||||
- _node:_ `any` - [Node](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md) to get URL for.
|
||||
- **Returns** `string` - URL string
|
||||
- **getMimeTypeIcon**(mimeType: `string`): `string`<br/>
|
||||
Gets a thumbnail URL for a MIME type.
|
||||
- _mimeType:_ `string` - MIME type for the thumbnail
|
||||
- **Returns** `string` - URL string
|
||||
|
||||
## Details
|
||||
|
||||
The service can locate a thumbnail icon (in SVG format) for either
|
||||
a document node or a MIME type. The default mapping between types
|
||||
and icons is shown in the table below:
|
||||
|
||||
| Document | Icon | Types |
|
||||
| -------- | ---- | ----- |
|
||||
| Compressed archive |  | 'application/x-compressed', 'application/x-zip-compressed', 'application/zip' |
|
||||
| Text |  | 'text/plain', 'application/json', 'application/x-javascript', 'application/vnd.apple.pages' |
|
||||
| Bitmap/raster image |  | 'image/png', 'image/jpeg', 'image/gif' |
|
||||
| MP4 video |  | 'video/mp4' |
|
||||
| SVG vector image |  | 'image/svg+xml' |
|
||||
| HTML file |  | 'text/html' |
|
||||
| PDF file |  | 'application/pdf' |
|
||||
| Folder |  | |
|
||||
| Disabled folder |  | |
|
||||
| Excel spreadsheet |  | 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/vnd.openxmlformats-officedocument.spreadsheetml.template' |
|
||||
| PowerPoint slideshow |  | 'application/vnd.ms-powerpoint', 'application/vnd.openxmlformats-officedocument.presentationml.presentation', 'application/vnd.openxmlformats-officedocument.presentationml.template', 'application/vnd.openxmlformats-officedocument.presentationml.slideshow' |
|
||||
| Word document |  | 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.wordprocessingml.template' |
|
||||
| Keynote presentation |  | 'application/vnd.apple.keynote' |
|
||||
| Numbers spreadsheet |  | 'application/vnd.apple.numbers' |
|
||||
|
||||
### Mat-icon
|
||||
|
||||
All the ADF icons for MIME types are now registered into the [`MatIconRegistry`](https://material.angular.io/components/icon/api), so you can use all
|
||||
the icons via the <mat-icon> tag:
|
||||
|
||||
```javascript
|
||||
import { ThumbnailService } from '@alfresco/adf-core';
|
||||
|
||||
constructor(public thumbnailService: ThumbnailService) {
|
||||
}
|
||||
```
|
||||
|
||||
```html
|
||||
MP4 <mat-icon svgIcon="video/mp4"></mat-icon>
|
||||
PDF <mat-icon svgIcon="application/pdf"></mat-icon>
|
||||
GIF <mat-icon svgIcon="image/gif"></mat-icon>
|
||||
.....
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
- [Mime type icon pipe](../pipes/mime-type-icon.pipe.md)
|
183
docs/core/services/translation.service.md
Normal file
183
docs/core/services/translation.service.md
Normal file
@@ -0,0 +1,183 @@
|
||||
---
|
||||
Title: Translation service
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2019-02-08
|
||||
---
|
||||
|
||||
# [Translation service](../../../lib/core/services/translation.service.ts "Defined in translation.service.ts")
|
||||
|
||||
Supports localisation.
|
||||
|
||||
## Class members
|
||||
|
||||
### Methods
|
||||
|
||||
- **addTranslationFolder**(name: `string` = `""`, path: `string` = `""`)<br/>
|
||||
Adds a new folder of translation source files.
|
||||
- _name:_ `string` - Name for the translation provider
|
||||
- _path:_ `string` - Path to the folder
|
||||
- **get**(key: `string|Array<string>`, interpolateParams?: `Object`): [`Observable`](http://reactivex.io/documentation/observable.html)`<string|any>`<br/>
|
||||
Gets the translation for the supplied key.
|
||||
- _key:_ `string|Array<string>` - Key to translate
|
||||
- _interpolateParams:_ `Object` - (Optional) String(s) to be interpolated into the main message
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<string|any>` - Translated text
|
||||
- **instant**(key: `string|Array<string>`, interpolateParams?: `Object`): `string|any`<br/>
|
||||
Directly returns the translation for the supplied key.
|
||||
- _key:_ `string|Array<string>` - Key to translate
|
||||
- _interpolateParams:_ `Object` - (Optional) String(s) to be interpolated into the main message
|
||||
- **Returns** `string|any` - Translated text
|
||||
- **loadTranslation**(lang: `string`, fallback?: `string`)<br/>
|
||||
Loads a translation file.
|
||||
- _lang:_ `string` - Language code for the language to load
|
||||
- _fallback:_ `string` - (Optional) Language code to fall back to if the first one was unavailable
|
||||
- **onTranslationChanged**(lang: `string`)<br/>
|
||||
Triggers a notification callback when the translation language changes.
|
||||
- _lang:_ `string` - The new language code
|
||||
- **use**(lang: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
|
||||
Sets the target language for translations.
|
||||
- _lang:_ `string` - Code name for the language
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - Translations available for the language
|
||||
|
||||
## Details
|
||||
|
||||
In the `get` and `instant` methods, the `interpolateParams` parameter supplies
|
||||
interpolation strings for keys that include them. For example, in the standard
|
||||
`en.json`, the `CORE.PAGINATION.ITEMS_RANGE` key is defined as:
|
||||
|
||||
<!-- {% raw %} -->
|
||||
|
||||
"Showing {{ range }} of {{ total }}"
|
||||
|
||||
<!-- {% endraw %} -->
|
||||
|
||||
The `range` and `total` interpolations are supplied to the `get` method using
|
||||
an object with fields of the same name:
|
||||
|
||||
```ts
|
||||
this.trans.get(
|
||||
"CORE.PAGINATION.ITEMS_RANGE",
|
||||
{
|
||||
range: "1..10",
|
||||
total: "122"
|
||||
}
|
||||
).subscribe(translation => {
|
||||
this.translatedText = translation;
|
||||
});
|
||||
```
|
||||
|
||||
### Registering translation sources
|
||||
|
||||
To supply your own set of translation source files, you
|
||||
first need to create a subfolder for them within your application's
|
||||
`assets` folder. The folder can have any name you like but it must also have
|
||||
a sub-folder called `i18n` where the translation lists will be stored. So, the
|
||||
general format of the path to this folder will be:
|
||||
|
||||
`<app>/src/assets/my-translations/i18n`
|
||||
|
||||
If you wanted English and French translations then you would add
|
||||
`en.json` and `fr.json` files into the `i18n` folder and add your new keys:
|
||||
|
||||
// en.json
|
||||
|
||||
...
|
||||
"WELCOME_MESSAGE": "Welcome!"
|
||||
...
|
||||
|
||||
// fr.json
|
||||
...
|
||||
"WELCOME_MESSAGE": "Bienvenue !"
|
||||
...
|
||||
|
||||
The files follow the same hierarchical key:value JSON format as the built-in translations.
|
||||
You can add new keys to your local files or redefine existing keys but the built-in definitions
|
||||
will be used for any keys you don't explicitly define in your files. For example, `en.json` might
|
||||
look like the following:
|
||||
|
||||
```json
|
||||
{
|
||||
"title": "my app",
|
||||
"LOGIN": {
|
||||
"LABEL": {
|
||||
"LOGIN": "Custom Sign In"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
To enable the new translations in your app, you also need to register them in your
|
||||
`app.module.ts` file. Import `TRANSLATION_PROVIDER` and add the path of your
|
||||
translations folder to the `providers`:
|
||||
|
||||
```ts
|
||||
// Other imports...
|
||||
|
||||
import { TRANSLATION_PROVIDER } from "@alfresco/adf-core";
|
||||
|
||||
...
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
...
|
||||
],
|
||||
declarations: [
|
||||
...
|
||||
],
|
||||
providers: [
|
||||
{
|
||||
provide: TRANSLATION_PROVIDER,
|
||||
multi: true,
|
||||
useValue: {
|
||||
name: 'my-translations',
|
||||
source: 'assets/my-translations'
|
||||
}
|
||||
}
|
||||
...
|
||||
```
|
||||
|
||||
You can now use your new keys in your component:
|
||||
|
||||
```ts
|
||||
...
|
||||
ngOnInit() {
|
||||
this.trans.use("fr");
|
||||
|
||||
this.trans.get("WELCOME_MESSAGE").subscribe(translation => {
|
||||
this.translatedText = translation;
|
||||
});
|
||||
}
|
||||
...
|
||||
```
|
||||
|
||||
Note: the `source` property points to the web application root. Ensure you have
|
||||
webpack correctly set up to copy all the i18n files at compile time.
|
||||
|
||||
```text
|
||||
index.html
|
||||
assets/ng2-alfresco-core/i18n/en.json
|
||||
...
|
||||
```
|
||||
|
||||
You can register as many entries as you like.
|
||||
|
||||
### Switching languages
|
||||
|
||||
Depending on your application, you may want to have buttons or dropdown menus to allow language selection for the end users.
|
||||
|
||||
You can use [`TranslationService`](../../core/services/translation.service.md) to switch languages from your code based on input events of your choice:
|
||||
|
||||
```ts
|
||||
class MyComponent {
|
||||
constructor(private translateService: TranslationService) {
|
||||
}
|
||||
|
||||
onLanguageClicked(lang: string) {
|
||||
this.translateService.use(lang || 'en');
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## See Also
|
||||
|
||||
- [Internationalization](../../user-guide/internationalization.md)
|
92
docs/core/services/upload.service.md
Normal file
92
docs/core/services/upload.service.md
Normal file
@@ -0,0 +1,92 @@
|
||||
---
|
||||
Title: Upload Service
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2019-01-16
|
||||
---
|
||||
|
||||
# [Upload Service](../../../lib/core/services/upload.service.ts "Defined in upload.service.ts")
|
||||
|
||||
Provides access to various APIs related to file upload features.
|
||||
|
||||
## Class members
|
||||
|
||||
### Methods
|
||||
|
||||
- **addToQueue**(files: [`FileModel`](../../../lib/core/models/file.model.ts)`[]`): [`FileModel`](../../../lib/core/models/file.model.ts)`[]`<br/>
|
||||
Adds files to the uploading queue to be uploaded
|
||||
- _files:_ [`FileModel`](../../../lib/core/models/file.model.ts)`[]` - One or more separate parameters or an array of files to queue
|
||||
- **Returns** [`FileModel`](../../../lib/core/models/file.model.ts)`[]` - Array of files that were not blocked from upload by the ignore list
|
||||
- **cancelUpload**(files: [`FileModel`](../../../lib/core/models/file.model.ts)`[]`)<br/>
|
||||
Cancels uploading of files.
|
||||
- _files:_ [`FileModel`](../../../lib/core/models/file.model.ts)`[]` - One or more separate parameters or an array of files specifying uploads to cancel
|
||||
- **clearQueue**()<br/>
|
||||
Clears the upload queue
|
||||
- **getQueue**(): [`FileModel`](../../../lib/core/models/file.model.ts)`[]`<br/>
|
||||
Gets the file Queue
|
||||
- **Returns** [`FileModel`](../../../lib/core/models/file.model.ts)`[]` - Array of files that form the queue
|
||||
- **getUploadPromise**(file: [`FileModel`](../../../lib/core/models/file.model.ts)): `any`<br/>
|
||||
Gets an upload promise for a file.
|
||||
- _file:_ [`FileModel`](../../../lib/core/models/file.model.ts) - The target file
|
||||
- **Returns** `any` - [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises) that is resolved if the upload is successful or error otherwise
|
||||
- **isUploading**(): `boolean`<br/>
|
||||
Checks whether the service is uploading a file.
|
||||
- **Returns** `boolean` - True if a file is uploading, false otherwise
|
||||
- **uploadFilesInTheQueue**(emitter?: [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<any>`)<br/>
|
||||
Finds all the files in the queue that are not yet uploaded and uploads them into the directory folder.
|
||||
- _emitter:_ [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<any>` - (Optional) Emitter to invoke on file status change
|
||||
|
||||
## Events
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ---- | ----------- |
|
||||
| queueChanged | [`FileModel`](../../../lib/core/models/file.model.ts)\[] | Emitted when the file queue changes. |
|
||||
| fileUpload | [`FileUploadEvent`](../../../lib/core/events/file.event.ts) | Emitted when a [File model](../../../lib/core/models/file.model.ts) changes its state. |
|
||||
| fileUploadStarting | [`FileUploadEvent`](../../../lib/core/events/file.event.ts) | Emitted when an upload starts. |
|
||||
| fileUploadCancelled | [`FileUploadEvent`](../../../lib/core/events/file.event.ts) | Emitted when an upload gets cancelled by the user. |
|
||||
| fileUploadProgress | [`FileUploadEvent`](../../../lib/core/events/file.event.ts) | Emitted during the file upload process and contains the current progress for a particular [File model](../../../lib/core/models/file.model.ts). |
|
||||
| fileUploadAborted | [`FileUploadEvent`](../../../lib/core/events/file.event.ts) | Emitted when a file upload gets aborted by the server. |
|
||||
| fileUploadError | [`FileUploadEvent`](../../../lib/core/events/file.event.ts) | Emitted when an error occurs during a file upload. |
|
||||
| fileUploadComplete | [`FileUploadCompleteEvent`](../../../lib/core/events/file.event.ts) | Emitted when a file upload is complete. |
|
||||
| fileUploadDelete | [`FileUploadDeleteEvent`](../../../lib/core/events/file.event.ts) | Emitted when an uploaded file is removed from server. |
|
||||
| fileDeleted | string | This can be invoked when a file is deleted from an external source to upload the file dialog status. |
|
||||
|
||||
## Details
|
||||
|
||||
### Ignore list configuration
|
||||
|
||||
You can add an ignore list for files that you don't want to be uploaded on your CS.
|
||||
The configuration of this service is saved in the `app.config.json` file
|
||||
(see the [App Config service](app-config.service.md) for more information).
|
||||
|
||||
The example below shows how to filter out the : '.git', '.DS_Store' and 'desktop.ini' files.
|
||||
Each element of the ignore list is a glob pattern string, so you could exclude all the `.txt`
|
||||
files, for example, by adding a `*.txt` pattern to the list.
|
||||
You can also specify some more options about how to perform the check via the `match-options` parameter.
|
||||
|
||||
In the example below, we have added the `nocase` option (ie, ignore case when performing the
|
||||
glob match), so `*.TXT` will also match `.txt`, etc.
|
||||
For more information about the options available please check the documentation for the
|
||||
[minimatch](https://www.npmjs.com/package/minimatch#options)
|
||||
node module.
|
||||
|
||||
**app.config.json**
|
||||
|
||||
```json
|
||||
{
|
||||
"ecmHost": "http://localhost:3000/ecm",
|
||||
"bpmHost": "http://localhost:3000/bpm",
|
||||
"application": {
|
||||
"name": "Alfresco"
|
||||
},
|
||||
"files": {
|
||||
"excluded": [".DS_Store", "desktop.ini", ".git", "*.txt"],
|
||||
"match-options": {
|
||||
"nocase": true
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Note that all standard glob patterns work and you can end patterns with a forward
|
||||
slash `/` character to specify a directory.
|
118
docs/core/services/user-preferences.service.md
Normal file
118
docs/core/services/user-preferences.service.md
Normal file
@@ -0,0 +1,118 @@
|
||||
---
|
||||
Title: User Preferences Service
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2019-01-16
|
||||
---
|
||||
|
||||
# [User Preferences Service](../../../lib/core/services/user-preferences.service.ts "Defined in user-preferences.service.ts")
|
||||
|
||||
Stores preferences for the app and for individual components.
|
||||
|
||||
## Class members
|
||||
|
||||
### Methods
|
||||
|
||||
- **get**(property: `string`, defaultValue?: `string`): `string`<br/>
|
||||
Gets a preference property.
|
||||
- _property:_ `string` - Name of the property
|
||||
- _defaultValue:_ `string` - (Optional) Default to return if the property is not found
|
||||
- **Returns** `string` - Preference property
|
||||
- **getDefaultLocale**(): `string`<br/>
|
||||
Gets the default locale.
|
||||
- **Returns** `string` - Default locale language code
|
||||
- **getPropertyKey**(property: `string`): `string`<br/>
|
||||
Gets the full property key with prefix.
|
||||
- _property:_ `string` - The property name
|
||||
- **Returns** `string` - [Property](../../../lib/content-services/content-metadata/interfaces/property.interface.ts) key
|
||||
- **getStoragePrefix**(): `string`<br/>
|
||||
Gets the active storage prefix for preferences.
|
||||
- **Returns** `string` - Storage prefix
|
||||
- **hasItem**(property: `string`): `boolean`<br/>
|
||||
Check if an item is present in the storage
|
||||
- _property:_ `string` - Name of the property
|
||||
- **Returns** `boolean` - True if the item is present, false otherwise
|
||||
- **select**(property: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
|
||||
Sets up a callback to notify when a property has changed.
|
||||
- _property:_ `string` - The property to watch
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - Notification callback
|
||||
- **set**(property: `string`, value: `any`)<br/>
|
||||
Sets a preference property.
|
||||
- _property:_ `string` - Name of the property
|
||||
- _value:_ `any` - New value for the property
|
||||
- **setStoragePrefix**(value: `string`)<br/>
|
||||
Sets the active storage prefix for preferences.
|
||||
- _value:_ `string` - Name of the prefix
|
||||
|
||||
## Details
|
||||
|
||||
The preferences are bound to a particular `prefix` so the application can switch between different profiles on demand.
|
||||
|
||||
For example, upon login you can set the `prefix` to the current username:
|
||||
|
||||
```ts
|
||||
import { UserPreferencesService, AuthenticationService } from '@alfresco/adf-core';
|
||||
|
||||
@Component({...})
|
||||
class AppComponent {
|
||||
constructor(private userPreferences: UserPreferencesService,
|
||||
private authService: AuthenticationService) {
|
||||
}
|
||||
|
||||
onLoggedIn() {
|
||||
this.userPreferences.setStoragePrefix(
|
||||
this.authService.getEcmUsername()
|
||||
);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
As soon as you assign the storage prefix, all settings that you get or set via the [`UserPreferencesService`](../../core/services/user-preferences.service.md) will be saved to a dedicated profile.
|
||||
|
||||
You can import the service into your controller and use its APIs as shown below:
|
||||
|
||||
```ts
|
||||
@Component({...})
|
||||
class AppComponent {
|
||||
constructor(userPreferences: UserPreferencesService) {
|
||||
|
||||
userPreferences.set('myProperty1', 'value1');
|
||||
userPreferences.set('myProperty2', 'value2');
|
||||
|
||||
console.log(
|
||||
userPreferences.get('myProperty1')
|
||||
);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The service also provides quick access to a set of the "known" properties used across ADF components:
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ---- | ----------- |
|
||||
| authType | `string` | Authorization type (can be "ECM", "BPM" or "ALL"). |
|
||||
| disableCSRF | `boolean` | Prevents the CSRF Token from being submitted if true. Only valid for Process Services. |
|
||||
| paginationSize | `number` | [`Pagination`](../../../lib/content-services/document-list/models/document-library.model.ts) size. |
|
||||
| locale | `string` | Current locale setting. |
|
||||
|
||||
## User Preference onChange Stream
|
||||
|
||||
Whenever a property is set with the [user preferences service,](user-preferences.service.md) an `onChange` event is sent with the
|
||||
whole set of user properties. This is useful when a component needs to react to a property change:
|
||||
|
||||
```ts
|
||||
userPreferences.paginationSize = 10;
|
||||
userPreferences.onChange().subscribe((userStatusValues) => {
|
||||
console.log(userStatusValues.PAGINATION_SIZE); //this will be 10
|
||||
});
|
||||
```
|
||||
|
||||
You can also use the `select` method to get notification when a particular property is changed.
|
||||
A set of basic properties is added into the enumeration [`UserPreferenceValues`](../../../lib/core/services/user-preferences.service.ts) which gives you the key value to access the standard user preference service properties : **PaginationSize**, **DisableCSRF**, **Locale** and **SupportedPageSizes**.
|
||||
|
||||
```ts
|
||||
userPreferences.disableCSRF = true;
|
||||
userPreferences.select(UserPreferenceValues.DisableCSRF).subscribe((CSRFflag) => {
|
||||
console.log(CSRFflag); //this will be true;
|
||||
});
|
||||
```
|
Reference in New Issue
Block a user