[ADF-1769] Added JSDocs and methods and updated script (#2927)

This commit is contained in:
Andy Stark
2018-02-09 18:06:24 +00:00
committed by Eugenio Romano
parent 2bfed5818f
commit 76ad797488
16 changed files with 219 additions and 109 deletions

View File

@@ -27,7 +27,8 @@ var ParamData = /** @class */ (function () {
var sig = this.name;
if (this.optional)
sig += "?";
sig += ": " + this.type;
if (this.type)
sig += ": " + this.type;
if (this.initializer)
sig += " = " + this.initializer;
return sig;
@@ -134,6 +135,8 @@ var ServiceDocAutoContent = /** @class */ (function () {
var methData = new MethodData();
methData.name = memSymbol.getName();
var doc = ts.displayPartsToString(memSymbol.getDocumentationComment());
if (!doc)
console.log("Warning: Method " + classDec.name.escapedText + "." + methData.name + " is not documented");
methData.docText = doc.replace(/\r\n/g, " ");
var sig = checker.getSignatureFromDeclaration(method);
var returnType = sig.getReturnType();
@@ -143,9 +146,14 @@ var ServiceDocAutoContent = /** @class */ (function () {
for (var p = 0; p < params.length; p++) {
var pData = new ParamData();
pData.name = params[p].name.getText();
pData.type = params[p].type.getText();
if (params[p].type)
pData.type = params[p].type.getText();
else
pData.type = "";
var paramSymbol = checker.getSymbolAtLocation(params[p].name);
pData.docText = ts.displayPartsToString(paramSymbol.getDocumentationComment());
if (!pData.docText)
console.log("Warning: Parameter \"" + pData.name + "\" of " + classDec.name.escapedText + "." + methData.name + " is not documented");
pData.optional = params[p].questionToken ? true : false;
if (params[p].initializer) {
var initText = params[p].initializer.getText();

View File

@@ -39,12 +39,13 @@ class ParamData {
optional: boolean;
getSignature() {
let sig =this.name;
let sig = this.name;
if (this.optional)
sig += "?";
sig += ": " + this.type;
if (this.type)
sig += ": " + this.type;
if (this.initializer)
sig += " = " + this.initializer;
@@ -192,6 +193,10 @@ class ServiceDocAutoContent implements NgDocAutoContent {
methData.name = memSymbol.getName();
let doc = ts.displayPartsToString(memSymbol.getDocumentationComment());
if (!doc)
console.log(`Warning: Method ${classDec.name.escapedText}.${methData.name} is not documented`);
methData.docText = doc.replace(/\r\n/g, " ");
let sig = checker.getSignatureFromDeclaration(method);
let returnType = sig.getReturnType();
@@ -203,9 +208,18 @@ class ServiceDocAutoContent implements NgDocAutoContent {
for (let p = 0; p < params.length; p++){
let pData = new ParamData();
pData.name = params[p].name.getText();
pData.type = params[p].type.getText();
if (params[p].type)
pData.type = params[p].type.getText();
else
pData.type = "";
let paramSymbol = checker.getSymbolAtLocation(params[p].name);
pData.docText = ts.displayPartsToString(paramSymbol.getDocumentationComment());
if (!pData.docText)
console.log(`Warning: Parameter "${pData.name}" of ${classDec.name.escapedText}.${methData.name} is not documented`);
pData.optional = params[p].questionToken ? true : false;
if (params[p].initializer) {

View File

@@ -41,6 +41,10 @@ export class DocumentActionsService {
this.setupActionHandlers();
}
/**
* Gets the handler for an action.
* @param key Identifier of the action
*/
getHandler(key: string): ContentActionHandler {
if (key) {
let lkey = key.toLowerCase();
@@ -49,6 +53,11 @@ export class DocumentActionsService {
return null;
}
/**
* Sets a new handler for an action.
* @param key Identifier of the action
* @param handler Handler for the action
*/
setHandler(key: string, handler: ContentActionHandler): boolean {
if (key) {
let lkey = key.toLowerCase();
@@ -58,6 +67,10 @@ export class DocumentActionsService {
return false;
}
/**
* Checks if actions can be executed for an item.
* @param obj Item to receive an action
*/
canExecuteAction(obj: any): boolean {
return this.documentListService && obj && obj.entry.isFile === true;
}

View File

@@ -62,6 +62,10 @@ export class DocumentListService {
return this.apiService.getInstance().nodes.getNodeChildren(rootNodeId, params);
}
/**
* Deletes a node.
* @param nodeId ID of the node to delete
*/
deleteNode(nodeId: string): Observable<any> {
return Observable.fromPromise(this.apiService.getInstance().nodes.deleteNode(nodeId));
}
@@ -70,7 +74,7 @@ export class DocumentListService {
* Copy a node to destination node
*
* @param nodeId The id of the node to be copied
* @param targetParentId The id of the folder-node where the node have to be copied to
* @param targetParentId The id of the folder where the node will be copied
*/
copyNode(nodeId: string, targetParentId: string) {
return Observable.fromPromise(this.apiService.getInstance().nodes.copyNode(nodeId, { targetParentId }))
@@ -81,7 +85,7 @@ export class DocumentListService {
* Move a node to destination node
*
* @param nodeId The id of the node to be moved
* @param targetParentId The id of the folder-node where the node have to be moved to
* @param targetParentId The id of the folder where the node will be moved
*/
moveNode(nodeId: string, targetParentId: string) {
return Observable.fromPromise(this.apiService.getInstance().nodes.moveNode(nodeId, { targetParentId }))
@@ -111,6 +115,10 @@ export class DocumentListService {
.catch(err => this.handleError(err));
}
/**
* Gets a folder node via its node ID.
* @param nodeId ID of the folder node
*/
getFolderNode(nodeId: string): Promise<MinimalNodeEntryEntity> {
let opts: any = {
includeSource: true,
@@ -130,14 +138,26 @@ export class DocumentListService {
return this.thumbnailService.getDocumentThumbnailUrl(node);
}
/**
* Gets the icon that represents a MIME type.
* @param mimeType MIME type to get the icon for
*/
getMimeTypeIcon(mimeType: string): string {
return this.thumbnailService.getMimeTypeIcon(mimeType);
}
/**
* Gets a default icon for MIME types with no specific icon.
*/
getDefaultMimeTypeIcon(): string {
return this.thumbnailService.getDefaultMimeTypeIcon();
}
/**
* Checks if a node has the specified permission.
* @param node Target node
* @param permission Permission level to query
*/
hasPermission(node: any, permission: PermissionsEnum|string): boolean {
return this.contentService.hasPermission(node, permission);
}

View File

@@ -133,7 +133,7 @@ export class ContentService {
/**
* Get thumbnail URL for the given document node.
*
* @param {string|MinimalNodeEntity} nodeId or node to get URL for.
* @param {string|MinimalNodeEntity} node Node to get URL for.
* @param {boolean} [attachment] Retrieve content as an attachment for download
* @param {string} [ticket] Custom ticket to use for authentication
* @returns {string} The URL address pointing to the content.
@@ -166,7 +166,7 @@ export class ContentService {
/**
* Get content for the given node.
* @param nodeId {string}.
* @param nodeId ID of the target node
*
* @returns {Observable<any>} URL address.
*/
@@ -178,7 +178,9 @@ export class ContentService {
/**
* Create a folder
* @param name - the folder name
* @param relativePath Location to create the folder
* @param name Folder name
* @param parentId Node ID of parent folder
*/
createFolder(relativePath: string, name: string, parentId?: string): Observable<FolderCreatedEvent> {
return Observable.fromPromise(this.apiService.getInstance().nodes.createFolder(name, relativePath, parentId))
@@ -195,8 +197,8 @@ export class ContentService {
/**
* Check if the user has permissions on that node
* @param MinimalNode - node to check allowableOperations
* @param PermissionsEnum - create, delete, update, updatePermissions, !create, !delete, !update, !updatePermissions
* @param node Node to check allowableOperations
* @param permission Create, delete, update, updatePermissions, !create, !delete, !update, !updatePermissions
*
* @returns {boolean} has permission
*/
@@ -221,7 +223,7 @@ export class ContentService {
/**
* Check if the node has the properties allowableOperations
* @param MinimalNode - node to check allowableOperations
* @param node Node to check allowableOperations
*
* @returns {boolean} has AllowableOperations
*/

View File

@@ -20,6 +20,9 @@ import { Injectable } from '@angular/core';
@Injectable()
export class CookieService {
/**
* Checks if cookies are enabled.
*/
isEnabled(): boolean {
// for certain scenarios Chrome may say 'true' but have cookies still disabled
if (navigator.cookieEnabled === false) {
@@ -31,8 +34,8 @@ export class CookieService {
}
/**
* Retrieve cookie by key.
*
* Retrieves a cookie by its key.
* @param key Key to identify the cookie
* @returns {string | null}
*/
getItem(key: string): string | null {
@@ -43,10 +46,10 @@ export class CookieService {
/**
* Set a cookie.
* @param key
* @param data
* @param expiration
* @param path
* @param key Key to identify the cookie
* @param data Data value to set for the cookie
* @param expiration Expiration date of the data
* @param path "Pathname" to store the cookie
*
* @returns {boolean}
*/

View File

@@ -33,6 +33,10 @@ export class DeletedNodesApiService {
return this.apiService.getInstance().core.nodesApi;
}
/**
* Gets a list of nodes in the trash.
* @param options Options for JSAPI call
*/
getDeletedNodes(options?: Object): Observable<NodePaging> {
const { nodesApi, handleError } = this;
const defaultOptions = {

View File

@@ -28,6 +28,9 @@ export class DiscoveryApiService {
constructor(private apiService: AlfrescoApiService) { }
/**
* Gets product information for Content Services.
*/
public getEcmProductInfo() {
return Observable.fromPromise(
this.apiService.getInstance().discovery.discoveryApi.getRepositoryInformation())
@@ -35,6 +38,9 @@ export class DiscoveryApiService {
.catch(this.handleError);
}
/**
* Gets product information for Process Services.
*/
public getBpmProductInfo() {
return Observable.fromPromise(
this.apiService.getInstance().activiti.aboutApi.getAppVersion())

View File

@@ -33,8 +33,8 @@ export class EcmUserService {
}
/**
* get User Information via ECM
* @param userName - the user name
* Gets information about a user identified by their username.
* @param userName Target username
*/
getUserInfo(userName: string): Observable<EcmUserModel> {
return Observable.fromPromise(this.apiService.getInstance().core.peopleApi.getPerson(userName))
@@ -42,10 +42,17 @@ export class EcmUserService {
.catch(err => this.handleError(err));
}
/**
* Gets information about the user who is currently logged-in.
*/
getCurrentUserInfo() {
return this.getUserInfo('-me-');
}
/**
* Returns a profile image as a URL.
* @param avatarId Target avatar
*/
getUserProfileImage(avatarId: string) {
if (avatarId) {
let nodeObj = {entry: {id: avatarId}};