[ADF-2557] Updated docs with new props script (#3149)

* [ADF-2557] Updated docs for services with new props script

* [ADF-2557] Updated service docs with new props script
This commit is contained in:
Andy Stark
2018-04-08 16:23:04 +01:00
committed by Eugenio Romano
parent 8769c257f8
commit 1d517d3a8a
27 changed files with 612 additions and 299 deletions

View File

@@ -38,18 +38,38 @@ export class ProcessContentService {
return this.apiService.getInstance().activiti.contentApi;
}
/**
* Create temporary related content from an uploaded file.
* @param file File to use for content
* @returns The created content data
*/
createTemporaryRawRelatedContent(file: any): Observable<RelatedContentRepresentation> {
return Observable.fromPromise(this.contentApi.createTemporaryRawRelatedContent(file)).catch(err => this.handleError(err));
}
/**
* Gets the metadata for a related content item.
* @param contentId ID of the content item
* @returns Metadata for the content
*/
getFileContent(contentId: number): Observable<RelatedContentRepresentation> {
return Observable.fromPromise(this.contentApi.getContent(contentId)).catch(err => this.handleError(err));
}
/**
* Gets raw binary content data for a related content file.
* @param contentId ID of the related content
* @returns Binary data of the related content
*/
getFileRawContent(contentId: number): Observable<Blob> {
return Observable.fromPromise(this.contentApi.getRawContent(contentId)).catch(err => this.handleError(err));
}
/**
* Gets the preview for a related content file.
* @param contentId ID of the related content
* @returns Binary data of the content preview
*/
getContentPreview(contentId: number): Observable<Blob> {
return new Observable(observer => {
this.contentApi.getContentPreview(contentId).then(
@@ -73,39 +93,83 @@ export class ProcessContentService {
});
}
/**
* Gets a URL for direct access to a related content file.
* @param contentId ID of the related content
* @returns URL to access the content
*/
getFileRawContentUrl(contentId: number): string {
return this.contentApi.getRawContentUrl(contentId);
}
/**
* Gets the thumbnail for a related content file.
* @param contentId ID of the related content
* @returns Binary data of the thumbnail image
*/
getContentThumbnail(contentId: number): Observable<Blob> {
return Observable.fromPromise(this.contentApi.getContentThumbnail(contentId)).catch(err => this.handleError(err));
}
/**
* Gets related content items for a task instance.
* @param taskId ID of the target task
* @returns Metadata for the content
*/
getTaskRelatedContent(taskId: string): Observable<any> {
return Observable.fromPromise(this.contentApi.getRelatedContentForTask(taskId))
.catch(err => this.handleError(err));
}
/**
* Gets related content items for a process instance.
* @param processId ID of the target process
* @returns Metadata for the content
*/
getProcessRelatedContent(processId: string): Observable<any> {
return Observable.fromPromise(this.contentApi.getRelatedContentForProcessInstance(processId))
.catch(err => this.handleError(err));
}
/**
* Deletes related content.
* @param contentId Identifier of the content to delete
* @returns Null response that notifies when the deletion is complete
*/
deleteRelatedContent(contentId: number): Observable<any> {
return Observable.fromPromise(this.contentApi.deleteContent(contentId))
.catch(err => this.handleError(err));
}
/**
* Associates an uploaded file with a process instance.
* @param processInstanceId ID of the target process instance
* @param content File to associate
* @param opts Options supported by JSAPI
* @returns Details of created content
*/
createProcessRelatedContent(processInstanceId: string, content: any, opts?: any): Observable<any> {
return Observable.fromPromise(this.contentApi.createRelatedContentOnProcessInstance(processInstanceId, content, opts))
.catch(err => this.handleError(err));
}
/**
* Associates an uploaded file with a task instance.
* @param taskId ID of the target task
* @param file File to associate
* @param opts Options supported by JSAPI
* @returns Details of created content
*/
createTaskRelatedContent(taskId: string, file: any, opts?: any) {
return Observable.fromPromise(this.contentApi.createRelatedContentOnTask(taskId, file, opts))
.catch(err => this.handleError(err));
}
/**
* Creates a JSON representation of data.
* @param res Object representing data
* @returns JSON object
*/
toJson(res: any) {
if (res) {
return res || {};
@@ -113,6 +177,11 @@ export class ProcessContentService {
return {};
}
/**
* Creates a JSON array representation of data.
* @param res Object representing data
* @returns JSON array object
*/
toJsonArray(res: any) {
if (res) {
return res.data || [];
@@ -120,6 +189,11 @@ export class ProcessContentService {
return [];
}
/**
* Reports an error message.
* @param error Data object with optional `message` and `status` fields for the error
* @returns Callback when an error occurs
*/
handleError(error: any): Observable<any> {
let errMsg = ProcessContentService.UNKNOWN_ERROR_MESSAGE;
if (error) {

View File

@@ -30,6 +30,10 @@ export class AppsProcessService {
private logService: LogService) {
}
/**
* Gets a list of deployed apps for this user.
* @returns The list of deployed apps
*/
getDeployedApplications(): Observable<AppDefinitionRepresentation[]> {
return Observable.fromPromise(this.apiService.getInstance().activiti.appsApi.getAppDefinitions())
.map((response: any) => {
@@ -38,6 +42,11 @@ export class AppsProcessService {
.catch(err => this.handleError(err));
}
/**
* Gets a list of deployed apps for this user, where the app name is `name`.
* @param name Name of the app
* @returns The list of deployed apps
*/
getDeployedApplicationsByName(name: string): Observable<AppDefinitionRepresentation> {
return Observable.fromPromise(this.apiService.getInstance().activiti.appsApi.getAppDefinitions())
.map((response: any) => {
@@ -46,6 +55,11 @@ export class AppsProcessService {
.catch(err => this.handleError(err));
}
/**
* Gets the details for a specific app ID number.
* @param appId ID of the target app
* @returns Details of the app
*/
getApplicationDetailsById(appId: number): Observable<AppDefinitionRepresentation> {
return Observable.fromPromise(this.apiService.getInstance().activiti.appsApi.getAppDefinitions())
.map((response: any) => {

View File

@@ -32,6 +32,12 @@ export class CommentProcessService {
private logService: LogService) {
}
/**
* Adds a comment to a task.
* @param taskId ID of the target task
* @param message Text for the comment
* @returns Details about the comment
*/
addTaskComment(taskId: string, message: string): Observable<CommentModel> {
return Observable.fromPromise(this.apiService.getInstance().activiti.taskApi.addTaskComment({message: message}, taskId))
.map(res => res)
@@ -46,6 +52,11 @@ export class CommentProcessService {
}
/**
* Gets all comments that have been added to a task.
* @param taskId ID of the target task
* @returns Details for each comment
*/
getTaskComments(taskId: string): Observable<CommentModel[]> {
return Observable.fromPromise(this.apiService.getInstance().activiti.taskApi.getTaskComments(taskId))
.map(res => res)
@@ -59,6 +70,11 @@ export class CommentProcessService {
}).catch(err => this.handleError(err));
}
/**
* Gets all comments that have been added to a process instance.
* @param processInstanceId ID of the target process instance
* @returns Details for each comment
*/
getProcessInstanceComments(processInstanceId: string): Observable<CommentModel[]> {
return Observable.fromPromise(this.apiService.getInstance().activiti.commentsApi.getProcessInstanceComments(processInstanceId))
.map(res => res)
@@ -72,6 +88,12 @@ export class CommentProcessService {
}).catch(err => this.handleError(err));
}
/**
* Adds a comment to a process instance.
* @param processInstanceId ID of the target process instance
* @param message Text for the comment
* @returns Details of the comment added
*/
addProcessInstanceComment(processInstanceId: string, message: string): Observable<CommentModel> {
return Observable.fromPromise(
this.apiService.getInstance().activiti.commentsApi.addProcessInstanceComment({message: message}, processInstanceId)

View File

@@ -36,6 +36,7 @@ export class DeletedNodesApiService {
/**
* Gets a list of nodes in the trash.
* @param options Options for JSAPI call
* @returns List of nodes in the trash
*/
getDeletedNodes(options?: Object): Observable<NodePaging> {
const { nodesApi, handleError } = this;

View File

@@ -30,6 +30,7 @@ export class DiscoveryApiService {
/**
* Gets product information for Content Services.
* @returns ProductVersionModel containing product details
*/
public getEcmProductInfo() {
return Observable.fromPromise(
@@ -40,6 +41,7 @@ export class DiscoveryApiService {
/**
* Gets product information for Process Services.
* @returns ProductVersionModel containing product details
*/
public getBpmProductInfo() {
return Observable.fromPromise(

View File

@@ -42,6 +42,7 @@ export class NodesApiService {
* Gets the stored information about a node.
* @param nodeId ID of the target node
* @param options Optional parameters supported by JSAPI
* @returns Node information
*/
getNode(nodeId: string, options: any = {}): Observable<MinimalNodeEntryEntity> {
const { nodesApi, handleError, getEntryFromEntity } = this;
@@ -62,6 +63,7 @@ export class NodesApiService {
* Gets the items contained in a folder node.
* @param nodeId ID of the target node
* @param options Optional parameters supported by JSAPI
* @returns List of child items from the folder
*/
getNodeChildren(nodeId: string, options: any = {}): Observable<NodePaging> {
const { nodesApi, handleError } = this;
@@ -84,6 +86,7 @@ export class NodesApiService {
* @param parentNodeId ID of the parent folder node
* @param nodeBody Data for the new node
* @param options Optional parameters supported by JSAPI
* @returns Details of the new node
*/
createNode(parentNodeId: string, nodeBody: any, options: any = {}): Observable<MinimalNodeEntryEntity> {
const { nodesApi, handleError, getEntryFromEntity } = this;
@@ -99,6 +102,7 @@ export class NodesApiService {
* @param parentNodeId ID of the parent folder node
* @param nodeBody Data for the new folder
* @param options Optional parameters supported by JSAPI
* @returns Details of the new folder
*/
createFolder(parentNodeId: string, nodeBody: any, options: any = {}): Observable<MinimalNodeEntryEntity> {
const body = Object.assign({ nodeType: 'cm:folder' }, nodeBody);
@@ -110,6 +114,7 @@ export class NodesApiService {
* @param nodeId ID of the target node
* @param nodeBody New data for the node
* @param options Optional parameters supported by JSAPI
* @returns Updated node information
*/
updateNode(nodeId: string, nodeBody: any, options: any = {}): Observable<MinimalNodeEntryEntity> {
const { nodesApi, handleError, getEntryFromEntity } = this;
@@ -124,6 +129,7 @@ export class NodesApiService {
* Moves a node to the trashcan.
* @param nodeId ID of the target node
* @param options Optional parameters supported by JSAPI
* @returns Empty result that notifies when the deletion is complete
*/
deleteNode(nodeId: string, options: any = {}): Observable<void> {
const { nodesApi, handleError } = this;
@@ -138,6 +144,7 @@ export class NodesApiService {
/**
* Restores a node previously moved to the trashcan.
* @param nodeId ID of the node to restore
* @returns Details of the restored node
*/
restoreNode(nodeId: string): Observable<MinimalNodeEntryEntity> {
const { nodesApi, handleError, getEntryFromEntity } = this;
@@ -153,6 +160,7 @@ export class NodesApiService {
/**
* Reports an error.
* @param error Object representing the error
* @returns Error information
*/
handleError(error: any): Observable<any> {
return Observable.throw(error);

View File

@@ -32,6 +32,7 @@ export class PeopleContentService {
/**
* Gets information about a user identified by their username.
* @param personId ID of the target user
* @returns User information
*/
getPerson(personId: string): Observable<any> {
const { peopleApi, handleError } = this;
@@ -42,7 +43,10 @@ export class PeopleContentService {
.catch(handleError);
}
/** Gets information about the user who is currently logged-in. */
/**
* Gets information about the user who is currently logged in.
* @returns User information
*/
getCurrentPerson(): Observable<any> {
return this.getPerson('-me-');
}

View File

@@ -35,6 +35,7 @@ export class PeopleProcessService {
* Gets information about users across all tasks.
* @param taskId ID of the task
* @param searchWord Filter text to search for
* @returns Array of user information objects
*/
getWorkflowUsers(taskId?: string, searchWord?: string): Observable<UserProcessModel[]> {
let option = { excludeTaskId: taskId, filter: searchWord };
@@ -46,6 +47,7 @@ export class PeopleProcessService {
/**
* Gets the profile picture URL for the specified user.
* @param user The target user
* @returns Profile picture URL
*/
getUserImage(user: UserProcessModel): string {
return this.getUserProfileImageApi(user.id);
@@ -55,6 +57,7 @@ export class PeopleProcessService {
* Sets a user to be involved with a task.
* @param taskId ID of the target task
* @param idToInvolve ID of the user to involve
* @returns Empty response when the update completes
*/
involveUserWithTask(taskId: string, idToInvolve: string): Observable<UserProcessModel[]> {
let node = {userId: idToInvolve};
@@ -66,6 +69,7 @@ export class PeopleProcessService {
* Removes a user who is currently involved with a task.
* @param taskId ID of the target task
* @param idToRemove ID of the user to remove
* @returns Empty response when the update completes
*/
removeInvolvedUser(taskId: string, idToRemove: string): Observable<UserProcessModel[]> {
let node = {userId: idToRemove};

View File

@@ -60,14 +60,15 @@ export class UploadService {
/**
* Checks whether the service is uploading a file.
* @memberof UploadService
* @returns True if a file is uploading, false otherwise
*/
isUploading(): boolean {
return this.activeTask ? true : false;
}
/**
* Returns the file Queue
* Gets the file Queue
* @returns Array of files that form the queue
*/
getQueue(): FileModel[] {
return this.queue;
@@ -76,6 +77,7 @@ export class UploadService {
/**
* Adds files to the uploading queue to be uploaded
* @param files One or more separate parameters or an array of files to queue
* @returns Array of files that were not blocked from upload by the ignore list
*/
addToQueue(...files: FileModel[]): FileModel[] {
const allowedFiles = files.filter(f => this.filterElement(f));
@@ -95,10 +97,7 @@ export class UploadService {
/**
* Finds all the files in the queue that are not yet uploaded and uploads them into the directory folder.
*
* @param emitter (Deprecated) Emitter to invoke on file status change
*
* @memberof UploadService
*/
uploadFilesInTheQueue(emitter: EventEmitter<any>): void {
if (!this.activeTask) {
@@ -127,7 +126,7 @@ export class UploadService {
/**
* Cancels uploading of files.
* @param files One or more separate parameters or an array of files
* @param files One or more separate parameters or an array of files specifying uploads to cancel
*/
cancelUpload(...files: FileModel[]) {
files.forEach(file => {
@@ -154,6 +153,7 @@ export class UploadService {
/**
* Gets an upload promise for a file.
* @param file The target file
* @returns Promise that is resolved if the upload is successful or error otherwise
*/
getUploadPromise(file: FileModel) {
let opts: any = {

View File

@@ -35,6 +35,7 @@ export class EcmUserService {
/**
* Gets information about a user identified by their username.
* @param userName Target username
* @returns User information
*/
getUserInfo(userName: string): Observable<EcmUserModel> {
return Observable.fromPromise(this.apiService.getInstance().core.peopleApi.getPerson(userName))
@@ -44,6 +45,7 @@ export class EcmUserService {
/**
* Gets information about the user who is currently logged-in.
* @returns User information as for getUserInfo
*/
getCurrentUserInfo() {
return this.getUserInfo('-me-');
@@ -52,6 +54,7 @@ export class EcmUserService {
/**
* Returns a profile image as a URL.
* @param avatarId Target avatar
* @returns Image URL
*/
getUserProfileImage(avatarId: string) {
if (avatarId) {