[REPO-5552] more filtering capabilities for aspect/type api (#6713)

* [REPO-5552] more filtering capabilities for aspect/type api

* * fix BC
This commit is contained in:
dhrn
2021-02-26 03:20:14 +05:30
committed by GitHub
parent 42a5102e66
commit c932cb0964
4 changed files with 36 additions and 21 deletions

View File

@@ -45,8 +45,12 @@ export class AspectListService {
}
getStandardAspects(whiteList: string[]): Observable<AspectEntry[]> {
const where = `(modelIds in ('cm:contentmodel', 'emailserver:emailserverModel', 'smf:smartFolder', 'app:applicationmodel' ))`;
return from(this.alfrescoApiService.aspectsApi.listAspects({where}))
const where = `(modelId in ('cm:contentmodel', 'emailserver:emailserverModel', 'smf:smartFolder', 'app:applicationmodel' ))`;
const opts: any = {
where,
include: ['properties']
};
return from(this.alfrescoApiService.aspectsApi.listAspects(opts))
.pipe(
map((result: AspectPaging) => this.filterAspectByConfig(whiteList, result?.list?.entries)),
catchError((error) => {
@@ -58,7 +62,11 @@ export class AspectListService {
getCustomAspects(): Observable<AspectEntry[]> {
const where = `(not namespaceUri matches('http://www.alfresco.*'))`;
return from(this.alfrescoApiService.aspectsApi.listAspects({where}))
const opts: any = {
where,
include: ['properties']
};
return from(this.alfrescoApiService.aspectsApi.listAspects(opts))
.pipe(
map((result: AspectPaging) => result?.list?.entries),
catchError((error) => {

View File

@@ -58,7 +58,10 @@ describe('ContentTypeService', () => {
expect(results).not.toBeNull();
expect(results.length).toBe(1);
expect(results[0].entry.id).toBe('fake-type-id');
expect(mockTypesApi.listTypes).toHaveBeenCalledWith({ where: '(parentIds in (\'whatever-whenever\') and not namespaceUri matches(\'http://www.alfresco.org/model.*\'))' });
expect(mockTypesApi.listTypes).toHaveBeenCalledWith({
where: '(parentId in (\'whatever-whenever\') and not namespaceUri matches(\'http://www.alfresco.*\'))',
include: [ 'properties']
});
done();
});
});

View File

@@ -33,7 +33,11 @@ export class ContentTypeService {
}
getContentTypeChildren(nodeType: string): Observable<TypeEntry[]> {
const opts = {where : `(parentIds in ('${nodeType}') and not namespaceUri matches('http://www.alfresco.org/model.*'))`};
const where = `(parentId in ('${nodeType}') and not namespaceUri matches('http://www.alfresco.*'))`;
const opts: any = {
where,
include: ['properties']
};
return from(this.alfrescoApiService.typesApi.listTypes(opts)).pipe(
map((result: TypePaging) => result.list.entries)
);