mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-] update library to use new js-api 3.0.0 (#4097)
This commit is contained in:
committed by
Eugenio Romano
parent
2acd1b4e26
commit
3ef7d3b7ea
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { UserRepresentation } from 'alfresco-js-api';
|
||||
import { UserRepresentation } from '@alfresco/js-api';
|
||||
|
||||
export class BpmUserModel implements UserRepresentation {
|
||||
apps: any;
|
||||
@@ -39,28 +39,28 @@ export class BpmUserModel implements UserRepresentation {
|
||||
tenantPictureId: number;
|
||||
type: string;
|
||||
|
||||
constructor(obj?: any) {
|
||||
if (obj) {
|
||||
this.apps = obj.apps;
|
||||
this.capabilities = obj.capabilities;
|
||||
this.company = obj.company;
|
||||
this.created = obj.created;
|
||||
this.email = obj.email;
|
||||
this.externalId = obj.externalId;
|
||||
this.firstName = obj.firstName;
|
||||
this.lastName = obj.lastName;
|
||||
this.fullname = obj.fullname;
|
||||
this.groups = obj.groups;
|
||||
this.id = obj.id;
|
||||
this.lastUpdate = obj.lastUpdate;
|
||||
this.latestSyncTimeStamp = obj.latestSyncTimeStamp;
|
||||
this.password = obj.password;
|
||||
this.pictureId = obj.pictureId;
|
||||
this.status = obj.status;
|
||||
this.tenantId = obj.tenantId;
|
||||
this.tenantName = obj.tenantName;
|
||||
this.tenantPictureId = obj.tenantPictureId;
|
||||
this.type = obj.type;
|
||||
constructor(input?: any) {
|
||||
if (input) {
|
||||
this.apps = input.apps;
|
||||
this.capabilities = input.capabilities;
|
||||
this.company = input.company;
|
||||
this.created = input.created;
|
||||
this.email = input.email;
|
||||
this.externalId = input.externalId;
|
||||
this.firstName = input.firstName;
|
||||
this.lastName = input.lastName;
|
||||
this.fullname = input.fullname;
|
||||
this.groups = input.groups;
|
||||
this.id = input.id;
|
||||
this.lastUpdate = input.lastUpdate;
|
||||
this.latestSyncTimeStamp = input.latestSyncTimeStamp;
|
||||
this.password = input.password;
|
||||
this.pictureId = input.pictureId;
|
||||
this.status = input.status;
|
||||
this.tenantId = input.tenantId;
|
||||
this.tenantName = input.tenantName;
|
||||
this.tenantPictureId = input.tenantPictureId;
|
||||
this.type = input.type;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Person } from 'alfresco-js-api';
|
||||
import { Person } from '@alfresco/js-api';
|
||||
import { EcmCompanyModel } from '../../models/ecm-company.model';
|
||||
|
||||
export class EcmUserModel implements Person {
|
||||
|
@@ -16,13 +16,12 @@
|
||||
*/
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Response } from '@angular/http';
|
||||
import { Observable, from, throwError } from 'rxjs';
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
import { LogService } from '../../services/log.service';
|
||||
import { BpmUserModel } from '../models/bpm-user.model';
|
||||
import { map, catchError } from 'rxjs/operators';
|
||||
import { UserRepresentation } from 'alfresco-js-api';
|
||||
import { UserRepresentation } from '@alfresco/js-api';
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -45,8 +44,8 @@ export class BpmUserService {
|
||||
getCurrentUserInfo(): Observable<BpmUserModel> {
|
||||
return from(this.apiService.getInstance().activiti.profileApi.getProfile())
|
||||
.pipe(
|
||||
map((data: UserRepresentation) => {
|
||||
return new BpmUserModel(data);
|
||||
map((userRepresentation: UserRepresentation) => {
|
||||
return new BpmUserModel(userRepresentation);
|
||||
}),
|
||||
catchError((err) => this.handleError(err))
|
||||
);
|
||||
@@ -64,7 +63,7 @@ export class BpmUserService {
|
||||
* Throw the error
|
||||
* @param error
|
||||
*/
|
||||
private handleError(error: Response) {
|
||||
private handleError(error: any) {
|
||||
// in a real world app, we may send the error to some remote logging infrastructure
|
||||
// instead of just logging it to the console
|
||||
this.logService.error(error);
|
||||
|
@@ -16,14 +16,13 @@
|
||||
*/
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Response } from '@angular/http';
|
||||
import { Observable, from, throwError } from 'rxjs';
|
||||
import { map, catchError } from 'rxjs/operators';
|
||||
import { ContentService } from '../../services/content.service';
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
import { LogService } from '../../services/log.service';
|
||||
import { EcmUserModel } from '../models/ecm-user.model';
|
||||
import { PersonEntry } from 'alfresco-js-api';
|
||||
import { PersonEntry } from '@alfresco/js-api';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -74,7 +73,7 @@ export class EcmUserService {
|
||||
* Throw the error
|
||||
* @param error
|
||||
*/
|
||||
private handleError(error: Response) {
|
||||
private handleError(error: any) {
|
||||
this.logService.error(error);
|
||||
return throwError(error || 'Server error');
|
||||
}
|
||||
|
@@ -69,7 +69,7 @@ export class IdentityUserService {
|
||||
return from(this.apiService.getInstance().oauth2Auth.callCustomApi(
|
||||
url, httpMethod, pathParams, queryParams,
|
||||
headerParams, formParams, bodyParam, authNames,
|
||||
contentTypes, accepts, Object, null, null)
|
||||
contentTypes, accepts, null, null)
|
||||
).pipe(
|
||||
map((response: IdentityUserModel[]) => {
|
||||
return response;
|
||||
@@ -85,7 +85,7 @@ export class IdentityUserService {
|
||||
return from(this.apiService.getInstance().oauth2Auth.callCustomApi(
|
||||
url, httpMethod, pathParams, queryParams,
|
||||
headerParams, formParams, bodyParam, authNames,
|
||||
contentTypes, accepts, Object, null, null)
|
||||
contentTypes, accepts, null, null)
|
||||
).pipe(
|
||||
map((response: IdentityRoleModel[]) => {
|
||||
return response;
|
||||
|
Reference in New Issue
Block a user